Struct pushgen::SliceGenerator [−][src]
pub struct SliceGenerator<'a, T> { /* fields omitted */ }
Expand description
A generator that generates values from a slice.
Example
let data = [1, 2, 3, 4]; let mut sum = 0; SliceGenerator::new(&data).for_each(|x| sum += x); assert_eq!(sum, 10);
Implementations
Trait Implementations
type Output = &'a T
type Output = &'a T
Data-type generated by the generator.
Run the generator, emitting values to the output
closure. New values are emitted for
as long as the closure returns ValueResult::MoreValues
.
If the closure returns ValueResult::Stop
the generator must
return GeneratorResult::Stopped
. Read more
Auto Trait Implementations
impl<'a, T> Send for SliceGenerator<'a, T> where
T: Sync,
impl<'a, T> Sync for SliceGenerator<'a, T> where
T: Sync,
impl<'a, T> Unpin for SliceGenerator<'a, T>