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

Chains coroutines

see bind

Trait Implementations

Creates coroutine from a value

see result

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.