Struct bicoro::Coroutine [−][src]
pub struct Coroutine<'a, Input, Output, Result> { /* fields omitted */ }
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)