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> + '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
We have output to give to the executor
Next(Box<dyn FnOnce(Input) -> Coroutine<'a, Input, Output, Result> + 'a>)
The coroutine is suspended, awaiting input
Auto Trait Implementations
impl<'a, Input, Output, Result> !RefUnwindSafe for StepResult<'a, Input, Output, Result>
impl<'a, Input, Output, Result> !Send for StepResult<'a, Input, Output, Result>
impl<'a, Input, Output, Result> !Sync for StepResult<'a, Input, Output, Result>
impl<'a, Input, Output, Result> Unpin for StepResult<'a, Input, Output, Result>where
Output: Unpin,
Result: Unpin,
impl<'a, Input, Output, Result> !UnwindSafe for StepResult<'a, Input, Output, Result>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more