Trait pushgen::traits::IntoGenerator
source · pub trait IntoGenerator {
type Output;
type IntoGen: Generator<Output = Self::Output>;
// Required method
fn into_gen(self) -> Self::IntoGen;
}
Expand description
Conversion to a generator.
By implementing IntoGenerator
for a type you define how that type will be converted to a
generator.
Required Associated Types§
Required Methods§
sourcefn into_gen(self) -> Self::IntoGen
fn into_gen(self) -> Self::IntoGen
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§
source§impl<T, const N: usize> IntoGenerator for [T; N]
impl<T, const N: usize> IntoGenerator for [T; N]
source§impl<'a, T, const N: usize> IntoGenerator for &'a [T; N]
impl<'a, T, const N: usize> IntoGenerator for &'a [T; N]
source§impl<'a, T> IntoGenerator for &'a [T]
impl<'a, T> IntoGenerator for &'a [T]
source§impl<T> IntoGenerator for Vec<T>
Available on crate feature std
only.
impl<T> IntoGenerator for Vec<T>
Available on crate feature
std
only.source§impl<'t, T> IntoGenerator for &'t Option<T>
impl<'t, T> IntoGenerator for &'t Option<T>
source§impl<'a, T> IntoGenerator for &'a Vec<T>
Available on crate feature std
only.
impl<'a, T> IntoGenerator for &'a Vec<T>
Available on crate feature
std
only.