@@ -423,6 +423,13 @@ impl<T, S> IndexSet<T, S> {
423
423
}
424
424
425
425
426
+ /// An owning iterator over the items of a `IndexSet`.
427
+ ///
428
+ /// This `struct` is created by the [`into_iter`] method on [`IndexSet`]
429
+ /// (provided by the `IntoIterator` trait). See its documentation for more.
430
+ ///
431
+ /// [`IndexSet`]: struct.IndexSet.html
432
+ /// [`into_iter`]: struct.IndexSet.html#method.into_iter
426
433
pub struct IntoIter < T > {
427
434
iter : vec:: IntoIter < Bucket < T > > ,
428
435
}
@@ -446,6 +453,13 @@ impl<T> ExactSizeIterator for IntoIter<T> {
446
453
}
447
454
448
455
456
+ /// An iterator over the items of a `IndexSet`.
457
+ ///
458
+ /// This `struct` is created by the [`iter`] method on [`IndexSet`].
459
+ /// See its documentation for more.
460
+ ///
461
+ /// [`IndexSet`]: struct.IndexSet.html
462
+ /// [`iter`]: struct.IndexSet.html#method.iter
449
463
pub struct Iter < ' a , T : ' a > {
450
464
iter : slice:: Iter < ' a , Bucket < T > > ,
451
465
}
@@ -468,6 +482,25 @@ impl<'a, T> ExactSizeIterator for Iter<'a, T> {
468
482
}
469
483
}
470
484
485
+ impl < ' a , T > Clone for Iter < ' a , T > {
486
+ fn clone ( & self ) -> Self {
487
+ Iter { iter : self . iter . clone ( ) }
488
+ }
489
+ }
490
+
491
+ impl < ' a , T : fmt:: Debug > fmt:: Debug for Iter < ' a , T > {
492
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
493
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
494
+ }
495
+ }
496
+
497
+ /// A draining iterator over the items of a `IndexSet`.
498
+ ///
499
+ /// This `struct` is created by the [`drain`] method on [`IndexSet`].
500
+ /// See its documentation for more.
501
+ ///
502
+ /// [`IndexSet`]: struct.IndexSet.html
503
+ /// [`drain`]: struct.IndexSet.html#method.drain
471
504
pub struct Drain < ' a , T : ' a > {
472
505
iter : vec:: Drain < ' a , Bucket < T > > ,
473
506
}
@@ -595,6 +628,13 @@ impl<T, S> IndexSet<T, S>
595
628
}
596
629
597
630
631
+ /// A lazy iterator producing elements in the difference of `IndexSet`s.
632
+ ///
633
+ /// This `struct` is created by the [`difference`] method on [`IndexSet`].
634
+ /// See its documentation for more.
635
+ ///
636
+ /// [`IndexSet`]: struct.IndexSet.html
637
+ /// [`difference`]: struct.IndexSet.html#method.difference
598
638
pub struct Difference < ' a , T : ' a , S : ' a > {
599
639
iter : Iter < ' a , T > ,
600
640
other : & ' a IndexSet < T , S > ,
@@ -634,7 +674,29 @@ impl<'a, T, S> DoubleEndedIterator for Difference<'a, T, S>
634
674
}
635
675
}
636
676
677
+ impl < ' a , T , S > Clone for Difference < ' a , T , S > {
678
+ fn clone ( & self ) -> Self {
679
+ Difference { iter : self . iter . clone ( ) , ..* self }
680
+ }
681
+ }
682
+
683
+ impl < ' a , T , S > fmt:: Debug for Difference < ' a , T , S >
684
+ where T : fmt:: Debug + Eq + Hash ,
685
+ S : BuildHasher
686
+ {
687
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
688
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
689
+ }
690
+ }
691
+
637
692
693
+ /// A lazy iterator producing elements in the intersection of `IndexSet`s.
694
+ ///
695
+ /// This `struct` is created by the [`intersection`] method on [`IndexSet`].
696
+ /// See its documentation for more.
697
+ ///
698
+ /// [`IndexSet`]: struct.IndexSet.html
699
+ /// [`intersection`]: struct.IndexSet.html#method.intersection
638
700
pub struct Intersection < ' a , T : ' a , S : ' a > {
639
701
iter : Iter < ' a , T > ,
640
702
other : & ' a IndexSet < T , S > ,
@@ -674,7 +736,29 @@ impl<'a, T, S> DoubleEndedIterator for Intersection<'a, T, S>
674
736
}
675
737
}
676
738
739
+ impl < ' a , T , S > Clone for Intersection < ' a , T , S > {
740
+ fn clone ( & self ) -> Self {
741
+ Intersection { iter : self . iter . clone ( ) , ..* self }
742
+ }
743
+ }
744
+
745
+ impl < ' a , T , S > fmt:: Debug for Intersection < ' a , T , S >
746
+ where T : fmt:: Debug + Eq + Hash ,
747
+ S : BuildHasher ,
748
+ {
749
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
750
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
751
+ }
752
+ }
753
+
677
754
755
+ /// A lazy iterator producing elements in the symmetric difference of `IndexSet`s.
756
+ ///
757
+ /// This `struct` is created by the [`symmetric_difference`] method on
758
+ /// [`IndexSet`]. See its documentation for more.
759
+ ///
760
+ /// [`IndexSet`]: struct.IndexSet.html
761
+ /// [`symmetric_difference`]: struct.IndexSet.html#method.symmetric_difference
678
762
pub struct SymmetricDifference < ' a , T : ' a , S1 : ' a , S2 : ' a > {
679
763
iter : Chain < Difference < ' a , T , S2 > , Difference < ' a , T , S1 > > ,
680
764
}
@@ -711,7 +795,30 @@ impl<'a, T, S1, S2> DoubleEndedIterator for SymmetricDifference<'a, T, S1, S2>
711
795
}
712
796
}
713
797
798
+ impl < ' a , T , S1 , S2 > Clone for SymmetricDifference < ' a , T , S1 , S2 > {
799
+ fn clone ( & self ) -> Self {
800
+ SymmetricDifference { iter : self . iter . clone ( ) }
801
+ }
802
+ }
714
803
804
+ impl < ' a , T , S1 , S2 > fmt:: Debug for SymmetricDifference < ' a , T , S1 , S2 >
805
+ where T : fmt:: Debug + Eq + Hash ,
806
+ S1 : BuildHasher ,
807
+ S2 : BuildHasher ,
808
+ {
809
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
810
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
811
+ }
812
+ }
813
+
814
+
815
+ /// A lazy iterator producing elements in the union of `IndexSet`s.
816
+ ///
817
+ /// This `struct` is created by the [`union`] method on [`IndexSet`].
818
+ /// See its documentation for more.
819
+ ///
820
+ /// [`IndexSet`]: struct.IndexSet.html
821
+ /// [`union`]: struct.IndexSet.html#method.union
715
822
pub struct Union < ' a , T : ' a , S : ' a > {
716
823
iter : Chain < Iter < ' a , T > , Difference < ' a , T , S > > ,
717
824
}
@@ -746,6 +853,21 @@ impl<'a, T, S> DoubleEndedIterator for Union<'a, T, S>
746
853
}
747
854
}
748
855
856
+ impl < ' a , T , S > Clone for Union < ' a , T , S > {
857
+ fn clone ( & self ) -> Self {
858
+ Union { iter : self . iter . clone ( ) }
859
+ }
860
+ }
861
+
862
+ impl < ' a , T , S > fmt:: Debug for Union < ' a , T , S >
863
+ where T : fmt:: Debug + Eq + Hash ,
864
+ S : BuildHasher ,
865
+ {
866
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
867
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
868
+ }
869
+ }
870
+
749
871
750
872
impl < ' a , ' b , T , S1 , S2 > BitAnd < & ' b IndexSet < T , S2 > > for & ' a IndexSet < T , S1 >
751
873
where T : Eq + Hash + Clone ,
0 commit comments