pub trait IP2PConnections<M>:
Send
+ Sync
+ 'static {
// Required methods
fn send<'life0, 'async_trait>(
&'life0 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 self,
) -> Pin<Box<dyn Future<Output = Option<(PeerId, M)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn receive_from_peer<'life0, 'async_trait>(
&'life0 self,
peer: PeerId,
) -> Pin<Box<dyn Future<Output = Option<M>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn into_dyn(self) -> DynP2PConnections<M>
where Self: Sized { ... }
}
Expand description
Connection manager that tries to keep connections open to all peers
Required Methods§
Sourcefn send<'life0, 'async_trait>(
&'life0 self,
recipient: Recipient,
msg: M,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 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.
Sourcefn try_send(&self, recipient: Recipient, msg: M)
fn try_send(&self, recipient: Recipient, msg: M)
Try to send message to recipient; drop message if channel is full.
Provided Methods§
Sourcefn into_dyn(self) -> DynP2PConnections<M>where
Self: Sized,
fn into_dyn(self) -> DynP2PConnections<M>where
Self: Sized,
Convert the struct to trait object.