[][src]Trait context_coroutine::Coroutine

pub trait Coroutine {
    type StartArguments: Sized;
    type ResumeArguments: Sized;
    type Yields: Sized;
    type Complete: Sized;
    fn coroutine<'yielder>(
        start_arguments: Self::StartArguments,
        yielder: Yielder<'yielder, Self::ResumeArguments, Self::Yields, Self::Complete>
    ) -> Self::Complete; }

A trait that stackful coroutines should implement.

Associated Types

type StartArguments: Sized

Type of the arguments the coroutine is initially called with, eg (usize, String).

type ResumeArguments: Sized

Type of the arguments the coroutine is resumed with, eg (u8, Vec<f64>).

type Yields: Sized

Type of the result from a yield of the coroutine.

type Complete: Sized

Type of the final result from the coroutine.

Loading content...

Required methods

fn coroutine<'yielder>(
    start_arguments: Self::StartArguments,
    yielder: Yielder<'yielder, Self::ResumeArguments, Self::Yields, Self::Complete>
) -> Self::Complete

Implement this for the coroutine's behaviour.

Panics inside the coroutine are transferred to the calling thread and raised.

Loading content...

Implementors

Loading content...