Trait rings_core::swarm::callback::SwarmCallback

source ·
pub trait SwarmCallback {
    // Provided methods
    fn on_validate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _payload: &'life1 MessagePayload
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_inbound<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _payload: &'life1 MessagePayload
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _event: &'life1 SwarmEvent
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Any object that implements this trait can be used as a callback for the swarm.

Provided Methods§

source

fn on_validate<'life0, 'life1, 'async_trait>( &'life0 self, _payload: &'life1 MessagePayload ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

This method is invoked when a new message is received and before handling.

source

fn on_inbound<'life0, 'life1, 'async_trait>( &'life0 self, _payload: &'life1 MessagePayload ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

This method is invoked when a new message is received and after handling. Will not be invoked if the message is not for this node.

source

fn on_event<'life0, 'life1, 'async_trait>( &'life0 self, _event: &'life1 SwarmEvent ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

This method is invoked after the Swarm handling.

Implementors§