Skip to content

Commit 6f8b2c0

Browse files
Remove deprecated repeat_call
1 parent fe8efae commit 6f8b2c0

File tree

2 files changed

+2
-59
lines changed

2 files changed

+2
-59
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub mod structs {
127127
pub use crate::rciter_impl::RcIter;
128128
pub use crate::repeatn::RepeatN;
129129
#[allow(deprecated)]
130-
pub use crate::sources::{Iterate, RepeatCall, Unfold};
130+
pub use crate::sources::{Iterate, Unfold};
131131
pub use crate::take_while_inclusive::TakeWhileInclusive;
132132
#[cfg(feature = "use_alloc")]
133133
pub use crate::tee::Tee;
@@ -156,7 +156,7 @@ pub use crate::peeking_take_while::PeekingNext;
156156
pub use crate::process_results_impl::process_results;
157157
pub use crate::repeatn::repeat_n;
158158
#[allow(deprecated)]
159-
pub use crate::sources::{iterate, repeat_call, unfold};
159+
pub use crate::sources::{iterate, unfold};
160160
#[allow(deprecated)]
161161
pub use crate::structs::*;
162162
pub use crate::unziptuple::{multiunzip, MultiUnzip};

src/sources.rs

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,6 @@
55
use std::fmt;
66
use std::mem;
77

8-
/// See [`repeat_call`](crate::repeat_call) for more information.
9-
#[derive(Clone)]
10-
#[deprecated(note = "Use std repeat_with() instead", since = "0.8.0")]
11-
pub struct RepeatCall<F> {
12-
f: F,
13-
}
14-
15-
impl<F> fmt::Debug for RepeatCall<F> {
16-
debug_fmt_fields!(RepeatCall,);
17-
}
18-
19-
/// An iterator source that produces elements indefinitely by calling
20-
/// a given closure.
21-
///
22-
/// Iterator element type is the return type of the closure.
23-
///
24-
/// ```
25-
/// use itertools::repeat_call;
26-
/// use itertools::Itertools;
27-
/// use std::collections::BinaryHeap;
28-
///
29-
/// let mut heap = BinaryHeap::from(vec![2, 5, 3, 7, 8]);
30-
///
31-
/// // extract each element in sorted order
32-
/// for element in repeat_call(|| heap.pop()).while_some() {
33-
/// print!("{}", element);
34-
/// }
35-
///
36-
/// itertools::assert_equal(
37-
/// repeat_call(|| 1).take(5),
38-
/// vec![1, 1, 1, 1, 1]
39-
/// );
40-
/// ```
41-
#[deprecated(note = "Use std repeat_with() instead", since = "0.8.0")]
42-
pub fn repeat_call<F, A>(function: F) -> RepeatCall<F>
43-
where
44-
F: FnMut() -> A,
45-
{
46-
RepeatCall { f: function }
47-
}
48-
49-
impl<A, F> Iterator for RepeatCall<F>
50-
where
51-
F: FnMut() -> A,
52-
{
53-
type Item = A;
54-
55-
#[inline]
56-
fn next(&mut self) -> Option<Self::Item> {
57-
Some((self.f)())
58-
}
59-
60-
fn size_hint(&self) -> (usize, Option<usize>) {
61-
(usize::MAX, None)
62-
}
63-
}
64-
658
/// Creates a new unfold source with the specified closure as the "iterator
669
/// function" and an initial state to eventually pass to the closure
6710
///

0 commit comments

Comments
 (0)