pub struct Cycle<T>(_);
Expand description
Recycle values from an iterator.
Since generators must produce an infinite sequence, this cycles the iterator to prevent it being exhausted.
Example:
use boulder::{Cycle, Generator};
let mut g = Cycle::new((1..3_i32).into_iter());
assert_eq!(g.generate(), 1);
assert_eq!(g.generate(), 2);
assert_eq!(g.generate(), 1);
Implementations
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Cycle<T> where
T: RefUnwindSafe,
impl<T> Send for Cycle<T> where
T: Send,
impl<T> Sync for Cycle<T> where
T: Sync,
impl<T> Unpin for Cycle<T> where
T: Unpin,
impl<T> UnwindSafe for Cycle<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more