fedimint_core::net::peers

Trait IPeerConnections

Source
pub trait IPeerConnections<M>{
    // Required methods
    fn send<'life0, 'async_trait>(
        &'life0 mut self,
        recipient: Recipient,
        msg: M,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn try_send(&self, recipient: Recipient, msg: M);
    fn receive<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Option<(PeerId, M)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn into_dyn(self) -> PeerConnections<M>
       where Self: Sized + Send + 'static { ... }
}
Expand description

Connection manager that tries to keep connections open to all peers

Required Methods§

Source

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

Send message to recipient; block if channel is full.

Source

fn try_send(&self, recipient: Recipient, msg: M)

Try to send message to recipient; drop message if channel is full.

Source

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

Await receipt of a message; return None if we are shutting down.

Provided Methods§

Source

fn into_dyn(self) -> PeerConnections<M>
where Self: Sized + Send + 'static,

Converts the struct to a PeerConnection trait object

Implementors§