Generator

Trait Generator 

Source
pub trait Generator {
    type Yield: ToNapiValue;
    type Next: FromNapiValue;
    type Return: FromNapiValue;

    // Required method
    fn next(&mut self, value: Option<Self::Next>) -> Option<Self::Yield>;

    // Provided methods
    fn complete(&mut self, value: Option<Self::Return>) -> Option<Self::Yield> { ... }
    fn catch<'env>(
        &'env mut self,
        env: Env,
        value: Unknown<'env>,
    ) -> Result<Option<Self::Yield>, Unknown<'env>> { ... }
}
Expand description

Implement a Iterator for the JavaScript Class. This feature is an experimental feature and is not yet stable.

Required Associated Types§

Required Methods§

Provided Methods§

Source

fn complete(&mut self, value: Option<Self::Return>) -> Option<Self::Yield>

Source

fn catch<'env>( &'env mut self, env: Env, value: Unknown<'env>, ) -> Result<Option<Self::Yield>, Unknown<'env>>

Implementors§