Trait Sender

Source
pub trait Sender<K: SignatureKey + 'static>:
    Send
    + Sync
    + 'static
    + Clone {
    // Required methods
    fn send_direct_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: &'life1 Bytes,
        recipient: K,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_broadcast_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: &'life1 Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The Sender trait is used to allow the [RequestResponseProtocol] to send messages to a specific recipient

Required Methods§

Source

fn send_direct_message<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 Bytes, recipient: K, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message to a specific recipient

Source

fn send_broadcast_message<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 Bytes, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message to all recipients

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, K> Sender<K> for T
where T: Deref<Target: ConnectedNetwork<K>> + Send + Sync + 'static + Clone, K: SignatureKey + 'static,

A blanket implementation of the Sender trait for all types that dereference to ConnectedNetwork