Trait ProcessEvent

Source
pub trait ProcessEvent<T>
where T: Send,
{ // Required methods fn process_network_event<'life0, 'async_trait>( &'life0 mut self, event: NetworkEvent, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn process_timer_event<'life0, 'async_trait>( &'life0 mut self, duration: Duration, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn process_event<'life0, 'async_trait>( &'life0 mut self, event: T, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn on_init<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn on_stat_interval<'life0, 'async_trait>( &'life0 mut self, current_time: Timestamp, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn is_ready_to_process(&self) -> bool; }
Expand description

Event Processing trait for the controllers. Handles both events from actions and timer

Required Methods§

Source

fn process_network_event<'life0, 'async_trait>( &'life0 mut self, event: NetworkEvent, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Processes an event coming from other peers via network controller

§Arguments
  • event:

returns: Option<()>

§Examples
Source

fn process_timer_event<'life0, 'async_trait>( &'life0 mut self, duration: Duration, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Triggered with each timer tick. duration will vary due to other processing tasks in the same thread.

§Arguments
  • duration:

returns: Option<()>

§Examples
Source

fn process_event<'life0, 'async_trait>( &'life0 mut self, event: T, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Processes the incoming events from other threads/controllers.

§Arguments
  • event:

returns: Option<()>

§Examples
Source

fn on_init<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn on_stat_interval<'life0, 'async_trait>( &'life0 mut self, current_time: Timestamp, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn is_ready_to_process(&self) -> bool

Implementors§