pub struct Coroutine<'a, Input, Output, Result> { /* private fields */ }
Expand description
A structure describing a co-routine supporting sends (inputs), yields (outputs), and a final termination (result)
This requires something else to execute it. a send or a yield will ‘pause’ the coroutine until the executor provides or consumes the output.
This structure is useful as you can logically describe a workflow, but leave the ‘plumbing’ of IO to later.
A simple case of input an output would be using enums. So that you can send and recieve different messages
This is represented as a monad https://en.wikipedia.org/wiki/Monad_(functional_programming)
Implementations
Trait Implementations
Auto Trait Implementations
impl<'a, Input, Output, Result> !RefUnwindSafe for Coroutine<'a, Input, Output, Result>
impl<'a, Input, Output, Result> !Send for Coroutine<'a, Input, Output, Result>
impl<'a, Input, Output, Result> !Sync for Coroutine<'a, Input, Output, Result>
impl<'a, Input, Output, Result> Unpin for Coroutine<'a, Input, Output, Result>where
Output: Unpin,
Result: Unpin,
impl<'a, Input, Output, Result> !UnwindSafe for Coroutine<'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