Trait pushgen::IntoGenerator[][src]

pub trait IntoGenerator {
    type Output;
    type IntoGen: Generator<Output = Self::Output>;
    fn into_gen(self) -> Self::IntoGen;
}

Associated Types

Data-type generated by the generator.

Which kind of generator are we turning this into?

Required methods

Creates a generator from a value.

See the module-level documentation for more.

Examples

Basic usage:

use pushgen::IntoGenerator;
use crate::pushgen::GeneratorExt;
let v = vec![1, 2, 3];
let mut gen = v.into_gen();

let mut output: Vec<i32> = Vec::new();
gen.for_each(|x| output.push(x));
assert_eq!(output, [1, 2, 3]);

Implementations on Foreign Types

Implementors