core::iter::repeat_with: document DoubleEndedIterator behavior

This commit is contained in:
Mazdak Farrokhzad 2018-02-12 18:03:56 +01:00
parent efa332038c
commit 9cee79a7ff

View 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: