Skip to content

Commit 669d1cd

Browse files
committed
std: Deprecate iter::{Unfold, Iterate}
Neither of these iterators has seen enough usage to justify their position in the standard library, so these unstable iterators are being slated for deletion.
1 parent 02a8d5b commit 669d1cd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libcore/iter.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,6 +2542,9 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
25422542
/// ```
25432543
#[unstable(feature = "iter_unfold")]
25442544
#[derive(Clone)]
2545+
#[deprecated(since = "1.2.0",
2546+
reason = "has gained enough traction to retain its position \
2547+
in the standard library")]
25452548
pub struct Unfold<St, F> {
25462549
f: F,
25472550
/// Internal state that will be passed to the closure on the next iteration
@@ -2550,6 +2553,9 @@ pub struct Unfold<St, F> {
25502553
}
25512554

25522555
#[unstable(feature = "iter_unfold")]
2556+
#[deprecated(since = "1.2.0",
2557+
reason = "has gained enough traction to retain its position \
2558+
in the standard library")]
25532559
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
25542560
/// Creates a new iterator with the specified closure as the "iterator
25552561
/// function" and an initial state to eventually pass to the closure
@@ -2995,11 +3001,17 @@ type IterateState<T, F> = (F, Option<T>, bool);
29953001
/// An iterator that repeatedly applies a given function, starting
29963002
/// from a given seed value.
29973003
#[unstable(feature = "iter_iterate")]
3004+
#[deprecated(since = "1.2.0",
3005+
reason = "has gained enough traction to retain its position \
3006+
in the standard library")]
29983007
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
29993008

30003009
/// Creates a new iterator that produces an infinite sequence of
30013010
/// repeated applications of the given function `f`.
30023011
#[unstable(feature = "iter_iterate")]
3012+
#[deprecated(since = "1.2.0",
3013+
reason = "has gained enough traction to retain its position \
3014+
in the standard library")]
30033015
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
30043016
T: Clone,
30053017
F: FnMut(T) -> T,

0 commit comments

Comments
 (0)