@@ -1825,10 +1825,20 @@ pub trait Iterator {
18251825 Inspect :: new ( self , f)
18261826 }
18271827
1828- /// Borrows an iterator, rather than consuming it .
1828+ /// Iterator adapter that turns ownership-taking methods into mutating methods .
18291829 ///
1830- /// This is useful to allow applying iterator adapters while still
1831- /// retaining ownership of the original iterator.
1830+ /// Most `Iterator` methods, other than the `next` method (and this one),
1831+ /// take ownership (via a `self` parameter) of the iterator and then mutate it.
1832+ /// This method retuns a mutable reference to the original iterator,
1833+ /// that acts like the original iterator in all respects,
1834+ /// except that ownership-taking methods take ownership of the reference instead of of the original.
1835+ /// All mutation by ownership-taking methods will still mutate the original iterator.
1836+ ///
1837+ /// # Technical details
1838+ ///
1839+ /// The mutable reference that this method returns, implements the `Iterator` trait via:
1840+ /// [impl<I: Iterator + ?Sized> Iterator for &mut I { type Item = I::Item; ...}](trait.Iterator.html#impl-Iterator-for-%26mut I).
1841+ /// This implementation simply passes all method calls on to the original iterator.
18321842 ///
18331843 /// # Examples
18341844 ///
@@ -4019,6 +4029,7 @@ where
40194029 }
40204030}
40214031
4032+ /// Implements `Iterator` for mutable references to iterators, such as those produced by [`Iterator::by_ref`].
40224033#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40234034impl < I : Iterator + ?Sized > Iterator for & mut I {
40244035 type Item = I :: Item ;
0 commit comments