Trait genawaiter::Coroutine

source ·
pub trait Coroutine {
    type Yield;
    type Resume;
    type Return;

    // Required method
    fn resume_with(
        self: Pin<&mut Self>,
        arg: Self::Resume
    ) -> GeneratorState<Self::Yield, Self::Return>;
}
Expand description

A trait implemented for coroutines.

A Coroutine is a generalization of a Generator. A Generator constrains the resume argument type to (), but in a Coroutine it can be anything.

Required Associated Types§

source

type Yield

The type of value this generator yields.

source

type Resume

The type of value this generator accepts as a resume argument.

source

type Return

The type of value this generator returns upon completion.

Required Methods§

source

fn resume_with( self: Pin<&mut Self>, arg: Self::Resume ) -> GeneratorState<Self::Yield, Self::Return>

Resumes the execution of this generator.

The argument will be passed into the coroutine as a resume argument.

Implementors§

source§

impl<'s, Y, R, F: Future> Coroutine for genawaiter::stack::Gen<'s, Y, R, F>

§

type Yield = Y

§

type Resume = R

§

type Return = <F as Future>::Output

source§

impl<Y, R, F: Future> Coroutine for genawaiter::rc::Gen<Y, R, F>

§

type Yield = Y

§

type Resume = R

§

type Return = <F as Future>::Output

source§

impl<Y, R, F: Future> Coroutine for genawaiter::sync::Gen<Y, R, F>

§

type Yield = Y

§

type Resume = R

§

type Return = <F as Future>::Output