@@ -113,12 +113,12 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
113113///
114114/// [`repeat_with`]: fn.repeat_with.html
115115#[ derive( Copy , Clone , Debug ) ]
116- #[ unstable ( feature = "iterator_repeat_with" , issue = "48169 " ) ]
116+ #[ stable ( feature = "iterator_repeat_with" , since = "1.28.0 " ) ]
117117pub struct RepeatWith < F > {
118118 repeater : F
119119}
120120
121- #[ unstable ( feature = "iterator_repeat_with" , issue = "48169 " ) ]
121+ #[ stable ( feature = "iterator_repeat_with" , since = "1.28.0 " ) ]
122122impl < A , F : FnMut ( ) -> A > Iterator for RepeatWith < F > {
123123 type Item = A ;
124124
@@ -129,13 +129,7 @@ impl<A, F: FnMut() -> A> Iterator for RepeatWith<F> {
129129 fn size_hint ( & self ) -> ( usize , Option < usize > ) { ( usize:: MAX , None ) }
130130}
131131
132- #[ unstable( feature = "iterator_repeat_with" , issue = "48169" ) ]
133- impl < A , F : FnMut ( ) -> A > DoubleEndedIterator for RepeatWith < F > {
134- #[ inline]
135- fn next_back ( & mut self ) -> Option < A > { self . next ( ) }
136- }
137-
138- #[ unstable( feature = "iterator_repeat_with" , issue = "48169" ) ]
132+ #[ stable( feature = "iterator_repeat_with" , since = "1.28.0" ) ]
139133impl < A , F : FnMut ( ) -> A > FusedIterator for RepeatWith < F > { }
140134
141135#[ unstable( feature = "trusted_len" , issue = "37572" ) ]
@@ -158,19 +152,15 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
158152///
159153/// [`repeat`]: fn.repeat.html
160154///
161- /// An iterator produced by `repeat_with()` is a `DoubleEndedIterator`.
162- /// It is important to note 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<_>>()`.
155+ /// An iterator produced by `repeat_with()` is not a `DoubleEndedIterator`.
156+ /// If you need `repeat_with()` to return a `DoubleEndedIterator`,
157+ /// please open a GitHub issue explaining your use case.
166158///
167159/// # Examples
168160///
169161/// Basic usage:
170162///
171163/// ```
172- /// #![feature(iterator_repeat_with)]
173- ///
174164/// use std::iter;
175165///
176166/// // let's assume we have some value of a type that is not `Clone`
@@ -191,8 +181,6 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
191181/// Using mutation and going finite:
192182///
193183/// ```rust
194- /// #![feature(iterator_repeat_with)]
195- ///
196184/// use std::iter;
197185///
198186/// // From the zeroth to the third power of two:
@@ -209,7 +197,7 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
209197/// assert_eq!(None, pow2.next());
210198/// ```
211199#[ inline]
212- #[ unstable ( feature = "iterator_repeat_with" , issue = "48169 " ) ]
200+ #[ stable ( feature = "iterator_repeat_with" , since = "1.28.0 " ) ]
213201pub fn repeat_with < A , F : FnMut ( ) -> A > ( repeater : F ) -> RepeatWith < F > {
214202 RepeatWith { repeater }
215203}
0 commit comments