TimerNode

Trait TimerNode 

Source
pub trait TimerNode<Context, Action>: Send + Sync
where Context: Send + Sync + 'static, Action: ActionType + Send + Sync + 'static + Default + Debug,
{ // Required methods fn schedule(&self) -> Schedule; fn execute_on_schedule<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn id(&self) -> NodeId; }
Expand description

A node that executes based on time schedules

Required Methods§

Source

fn schedule(&self) -> Schedule

Define the execution schedule

Source

fn execute_on_schedule<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the node on schedule

Source

fn id(&self) -> NodeId

Get the node’s unique identifier

Implementors§

Source§

impl<Context, Action, F> TimerNode<Context, Action> for SimpleTimer<F>
where Context: Send + Sync + 'static, Action: ActionType + Send + Sync + 'static + Default + Debug, F: Fn(&mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,