struct Coroutine<YieldT, RecvT = ()> { ... }

Coroutine object

Coroutine object is a reference to a running coroutine, which receives values of type RecvT and yields values of type YieldT. It is used to control the execution of the coroutine and to pass values to and from it.

A special case of coroutine is a generator (RecvT is not provided, defaults to ()), which does not receive any values, but only yields values. Generators also implement the Iterator trait, allowing them to be used in for loops.

Example

Methods

impl Coroutine<YieldT, RecvT> { ... }

impl Coroutine<T> { ... }

Mixins

impl Coroutine<T> { ... }