Enum bicoro::StepResult

source ·
pub enum StepResult<'a, Input, Output, Result> {
    Done(Result),
    Yield {
        output: Output,
        next: Box<Coroutine<'a, Input, Output, Result>>,
    },
    Next(Box<dyn FnOnce(Input) -> Coroutine<'a, Input, Output, Result> + Send + 'a>),
}
Expand description

A step wise evalution of the coroutine

this allows you to ‘iterate’ through until you need to provide input or to observe yields.

In the cause of input, a function is returned, it’s expected the executor will call this with the input.

In the cause of output, a tuple of the output and the remaining coroutine is returned.

In the coroutine is finished, it will be in the done case, so the return value can be extracted

Variants§

§

Done(Result)

The final value

§

Yield

Fields

§output: Output

The current output being provided to the executor

§next: Box<Coroutine<'a, Input, Output, Result>>

The remaining coroutine to process

We have output to give to the executor

§

Next(Box<dyn FnOnce(Input) -> Coroutine<'a, Input, Output, Result> + Send + 'a>)

The coroutine is suspended, awaiting input

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.