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

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[src]

The type of value this fiber consumes on each resume.

type Yield[src]

The type of value this fiber yields.

type Return[src]

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>
[src]

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 Return = R

type Yield = !

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

type Input = ()

type Return = R

type Yield = Y

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

type Input = ()

type Return = G::Return

type Yield = G::Yield

Loading content...