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§
sourcefn update_for_ms(&mut self, ms: u128)
fn update_for_ms(&mut self, ms: u128)
Run the update loop for a set amount of time (in milliseconds)
sourcefn update_loop(&mut self)
fn update_loop(&mut self)
Run the update loop until the executor’s interrupt is called
sourcefn check_interrupt(&mut self) -> bool
fn check_interrupt(&mut self) -> bool
Check whether the program has been interrupted
Note: This should be called between each Node execution
Provided Methods§
sourcefn add_node_with_context<CTX>(&mut self, node: Box<dyn Node>, _ctx: CTX)
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.