[][src]Trait drone_core::fib::Fiber

pub trait Fiber {
    type Input;
    type Yield;
    type Return;
    fn resume(
        self: Pin<&mut Self>,
        input: Self::Input
    ) -> FiberState<Self::Yield, Self::Return>; }

The main task unit of Drone.

Associated Types

type Input

The type of value this fiber consumes on each resume.

type Yield

The type of value this fiber yields.

type Return

The type of value this fiber returns on completion.

Loading content...

Required methods

fn resume(
    self: Pin<&mut Self>,
    input: Self::Input
) -> FiberState<Self::Yield, Self::Return>

Resumes the execution of this fiber.

This method will resume execution of the fiber or start execution if it hasn't already.

Return value

The FiberState enum returned from this method indicates what state the fiber is in upon returning. If FiberState::Yielded is returned then the fiber has reached a suspension point and a value has been yielded out. Fibers in this state are available for resumption on a later point.

If FiberState::Complete is returned then the fiber has completely finished with the value provided. It is invalid for the fiber to be resumed again.

Panics

This method may panic if it is called after FiberState::Complete has been returned previously.

Loading content...

Implementors

impl<F, R> Fiber for FiberOnce<F, R> where
    F: FnOnce() -> R,
    F: Unpin
[src]

type Input = ()

type Yield = !

type Return = R

impl<F, Y, R> Fiber for FiberFn<F, Y, R> where
    F: FnMut() -> FiberState<Y, R>, 
[src]

type Input = ()

type Yield = Y

type Return = R

impl<G> Fiber for FiberGen<G> where
    G: Generator
[src]

type Input = ()

type Yield = G::Yield

type Return = G::Return

Loading content...