Skip to main content

M2dirCoroutine

Trait M2dirCoroutine 

Source
pub trait M2dirCoroutine {
    type Yield;
    type Return;

    // Required method
    fn resume(
        &mut self,
        arg: Option<M2dirArg>,
    ) -> M2dirCoroutineState<Self::Yield, Self::Return>;
}
Expand description

Standard-shape m2dir coroutine.

Implementors own their internal state machine and declare their per-step Yield plus a terminal Return. The driver reacts to each Yield variant and resumes until Complete.

Required Associated Types§

Source

type Yield

Intermediate value handed back on every step. Per-coroutine: each implementor picks exactly the variants it needs. In io-m2dir every coroutine picks M2dirYield.

Source

type Return

Terminal value. By convention Result<Output, Error>; the “ok” arm carries the operation’s final output, the “error” arm carries the cause.

Required Methods§

Source

fn resume( &mut self, arg: Option<M2dirArg>, ) -> M2dirCoroutineState<Self::Yield, Self::Return>

Advances the coroutine one step.

Pass None on the initial call. Pass Some(arg) carrying the value matching the previous Yielded variant.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§