@@ -423,6 +423,13 @@ impl<T, S> IndexSet<T, S> {
423423}
424424
425425
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
426433pub struct IntoIter < T > {
427434 iter : vec:: IntoIter < Bucket < T > > ,
428435}
@@ -446,6 +453,13 @@ impl<T> ExactSizeIterator for IntoIter<T> {
446453}
447454
448455
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
449463pub struct Iter < ' a , T : ' a > {
450464 iter : slice:: Iter < ' a , Bucket < T > > ,
451465}
@@ -468,6 +482,25 @@ impl<'a, T> ExactSizeIterator for Iter<'a, T> {
468482 }
469483}
470484
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
471504pub struct Drain < ' a , T : ' a > {
472505 iter : vec:: Drain < ' a , Bucket < T > > ,
473506}
@@ -595,6 +628,13 @@ impl<T, S> IndexSet<T, S>
595628}
596629
597630
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
598638pub struct Difference < ' a , T : ' a , S : ' a > {
599639 iter : Iter < ' a , T > ,
600640 other : & ' a IndexSet < T , S > ,
@@ -634,7 +674,29 @@ impl<'a, T, S> DoubleEndedIterator for Difference<'a, T, S>
634674 }
635675}
636676
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+
637692
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
638700pub struct Intersection < ' a , T : ' a , S : ' a > {
639701 iter : Iter < ' a , T > ,
640702 other : & ' a IndexSet < T , S > ,
@@ -674,7 +736,29 @@ impl<'a, T, S> DoubleEndedIterator for Intersection<'a, T, S>
674736 }
675737}
676738
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+
677754
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
678762pub struct SymmetricDifference < ' a , T : ' a , S1 : ' a , S2 : ' a > {
679763 iter : Chain < Difference < ' a , T , S2 > , Difference < ' a , T , S1 > > ,
680764}
@@ -711,7 +795,30 @@ impl<'a, T, S1, S2> DoubleEndedIterator for SymmetricDifference<'a, T, S1, S2>
711795 }
712796}
713797
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+ }
714803
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
715822pub struct Union < ' a , T : ' a , S : ' a > {
716823 iter : Chain < Iter < ' a , T > , Difference < ' a , T , S > > ,
717824}
@@ -746,6 +853,21 @@ impl<'a, T, S> DoubleEndedIterator for Union<'a, T, S>
746853 }
747854}
748855
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+
749871
750872impl < ' a , ' b , T , S1 , S2 > BitAnd < & ' b IndexSet < T , S2 > > for & ' a IndexSet < T , S1 >
751873 where T : Eq + Hash + Clone ,
0 commit comments