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(
&mut self,
env: Env,
value: Unknown
) -> Result<Option<Self::Yield>, Unknown> { ... } }
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(
&mut self,
env: Env,
value: Unknown
) -> Result<Option<Self::Yield>, Unknown>

Implementors§