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

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>

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

type Cmd: Send + 'static

enum of all possible commands.

type CmdRes: Send + 'static

union of all possible command results.

type Req: Send + 'static

enum of all possible requests.

type ReqRes: Send + 'static

union of all possible request results.

Loading content...

Associated Constants

const STACK_SIZE: usize

Size of the process stack in bytes.

Loading content...

Required methods

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

The commands runner.

See ProcLoop for examples.

Loading content...

Provided methods

fn on_create()

Runs on the process creation.

fn on_enter()

Runs inside the synchronous context before the command loop.

fn on_drop()

Runs on the process destruction.

Loading content...

Implementors

Loading content...