Trait drone_core::proc_loop::ProcLoop[][src]

pub trait ProcLoop: Send + 'static {
    type Context: Context<Self::Req, Self::ReqRes>;
    type Cmd: Send + 'static;
    type CmdRes: Send + 'static;
    type Req: Send + 'static;
    type ReqRes: Send + 'static;

    const STACK_SIZE: usize;

    fn run_cmd(cmd: Self::Cmd, context: Self::Context) -> Self::CmdRes;

    fn on_create() { ... }
fn on_enter() { ... }
fn on_drop() { ... } }

The trait for declaring a synchronous command loop.

This trait uses only associated items, thus it doesn’t require the type to ever be instantiated.

Associated Types

type Context: Context<Self::Req, Self::ReqRes>[src]

Token type that allows suspending the task while waiting for a request result.

type Cmd: Send + 'static[src]

enum of all possible commands.

type CmdRes: Send + 'static[src]

union of all possible command results.

type Req: Send + 'static[src]

enum of all possible requests.

type ReqRes: Send + 'static[src]

union of all possible request results.

Loading content...

Associated Constants

const STACK_SIZE: usize[src]

Size of the process stack in bytes.

Loading content...

Required methods

fn run_cmd(cmd: Self::Cmd, context: Self::Context) -> Self::CmdRes[src]

The commands runner.

See ProcLoop for examples.

Loading content...

Provided methods

fn on_create()[src]

Runs on the process creation.

fn on_enter()[src]

Runs inside the synchronous context before the command loop.

fn on_drop()[src]

Runs on the process destruction.

Loading content...

Implementors

Loading content...