Trait ncomm_core::executor::Executor

source ·
pub trait Executor {
    // Required methods
    fn start(&mut self);
    fn update_for_ms(&mut self, ms: u128);
    fn update_loop(&mut self);
    fn check_interrupt(&mut self) -> bool;
    fn add_node(&mut self, node: Box<dyn Node>);

    // Provided method
    fn add_node_with_context<CTX>(&mut self, node: Box<dyn Node>, _ctx: CTX) { ... }
}
Expand description

An executor handles the scheduling and execution of nodes

Required Methods§

source

fn start(&mut self)

Starts the nodes contained by the executor

source

fn update_for_ms(&mut self, ms: u128)

Run the update loop for a set amount of time (in milliseconds)

source

fn update_loop(&mut self)

Run the update loop until the executor’s interrupt is called

source

fn check_interrupt(&mut self) -> bool

Check whether the program has been interrupted

Note: This should be called between each Node execution

source

fn add_node(&mut self, node: Box<dyn Node>)

Add a node to the executor.

Provided Methods§

source

fn add_node_with_context<CTX>(&mut self, node: Box<dyn Node>, _ctx: CTX)

Add a node to the executor with some given context.

Note: The context is mainly to allow for extra configuration when adding nodes.

Object Safety§

This trait is not object safe.

Implementors§