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
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