Skip to content

Commit 9cee79a

Browse files
committed
core::iter::repeat_with: document DoubleEndedIterator behavior
1 parent efa3320 commit 9cee79a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libcore/iter/sources.rs

+6
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
158158
///
159159
/// [`repeat`]: fn.repeat.html
160160
///
161+
/// An iterator produced by `repeat_with()` is a `DoubleEndedIterator`.
162+
/// It is important to not that reversing `repeat_with(f)` will produce
163+
/// the exact same sequence as the non-reversed iterator. In other words,
164+
/// `repeat_with(f).rev().collect::<Vec<_>>()` is equivalent to
165+
/// `repeat_with(f).collect::<Vec<_>>()`.
166+
///
161167
/// # Examples
162168
///
163169
/// Basic usage:

0 commit comments

Comments
 (0)