]> git.lizzy.rs Git - rust.git/commitdiff
core::iter::repeat_with: document DoubleEndedIterator behavior
authorMazdak Farrokhzad <twingoow@gmail.com>
Mon, 12 Feb 2018 17:03:56 +0000 (18:03 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Mon, 12 Feb 2018 17:03:56 +0000 (18:03 +0100)
src/libcore/iter/sources.rs

index b364292f57e94065f6b3bb37897990cc298e9fe6..abf2befa9cd1d7aa4f5406b406bfa1186114802f 100644 (file)
@@ -158,6 +158,12 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
 ///
 /// [`repeat`]: fn.repeat.html
 ///
+/// An iterator produced by `repeat_with()` is a `DoubleEndedIterator`.
+/// It is important to not that reversing `repeat_with(f)` will produce
+/// the exact same sequence as the non-reversed iterator. In other words,
+/// `repeat_with(f).rev().collect::<Vec<_>>()` is equivalent to
+/// `repeat_with(f).collect::<Vec<_>>()`.
+///
 /// # Examples
 ///
 /// Basic usage: