From 9cee79a7ff09851109f621bd4510909f5740ae28 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 12 Feb 2018 18:03:56 +0100 Subject: [PATCH] core::iter::repeat_with: document DoubleEndedIterator behavior --- src/libcore/iter/sources.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index b364292f57e..abf2befa9cd 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -158,6 +158,12 @@ unsafe impl A> TrustedLen for RepeatWith {} /// /// [`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::>()` is equivalent to +/// `repeat_with(f).collect::>()`. +/// /// # Examples /// /// Basic usage: -- 2.44.0