Trait ncomm_core::node::Node

source ·
pub trait Node: Send {
    // Required method
    fn get_update_delay_us(&self) -> u128;

    // Provided methods
    fn start(&mut self) { ... }
    fn update(&mut self) { ... }
    fn shutdown(&mut self) { ... }
}
Expand description

A Node represents a singular process that performs some singular purpose

Required Methods§

source

fn get_update_delay_us(&self) -> u128

Return the node’s update rate (in us)

Provided Methods§

source

fn start(&mut self)

Complete the necessary setup functionalities for a Node.

Note: this method is called on Start for the executor or (if the executor was not formally started) before the executor begins updating nodes.

source

fn update(&mut self)

Update is called by the executor every get_update_delay microseconds.

This can be compared to Arduino’s void loop and should include the work completed by this node every “tick”.

source

fn shutdown(&mut self)

When an executor is stopped or has finished executing nodes, it will call this method on all of its nodes so this should clean up any work the node needs to do.

Implementors§