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

The output type.

Make a new object. Read more

Available on crate feature persian-rug only.

The output type.

Available on crate feature persian-rug only.

Make a new object. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.