Skip to main content

StateChangeHandler

Trait StateChangeHandler 

Source
pub trait StateChangeHandler: Send + Sync {
    // Required method
    fn on_state_changed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        group_name: &'life1 str,
        state: GroupState,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for handling state machine state changes.

This is an app-layer trait (not part of core API) for receiving notifications when the group state changes.

Required Methods§

Source

fn on_state_changed<'life0, 'life1, 'async_trait>( &'life0 self, group_name: &'life1 str, state: GroupState, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when the group state changes (PendingJoin, Working, Waiting, Leaving).

§Arguments
  • group_name - The name of the group
  • state - The new state

Implementors§