NetworkSender

Trait NetworkSender 

Source
pub trait NetworkSender: Send + Sync {
    // Required methods
    fn send_message<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        peer_id: &'life1 PeerId,
        protocol: &'life2 str,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn local_peer_id(&self) -> &PeerId;
}
Expand description

Network sender trait for sending messages

Required Methods§

Source

fn send_message<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer_id: &'life1 PeerId, protocol: &'life2 str, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send a message to a specific peer

Source

fn local_peer_id(&self) -> &PeerId

Get our local peer ID

Implementors§

Source§

impl NetworkSender for P2PNetworkSender

Implementation of NetworkSender trait for P2PNetworkSender