pub trait IMuxPeerConnections<MuxKey, Msg>where
Msg: Serialize + DeserializeOwned + Unpin + Send,
MuxKey: Serialize + DeserializeOwned + Unpin + Send,{
// Required methods
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
peers: &'life1 [PeerId],
mux_key: MuxKey,
msg: Msg,
) -> Pin<Box<dyn Future<Output = Cancellable<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn receive<'life0, 'async_trait>(
&'life0 self,
mux_key: MuxKey,
) -> Pin<Box<dyn Future<Output = Cancellable<(PeerId, Msg)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn into_dyn(self) -> MuxPeerConnections<MuxKey, Msg>
where Self: Sized + Send + Sync + Unpin + 'static { ... }
}
Expand description
Like IPeerConnections
but with an ability to handle multiple
destinations (like modules) per each peer-connection.
Notably, unlike IPeerConnections
implementations need to be thread-safe,
as the primary intended use should support multiple threads using
multiplexed channel at the same time.
Required Methods§
Sourcefn send<'life0, 'life1, 'async_trait>(
&'life0 self,
peers: &'life1 [PeerId],
mux_key: MuxKey,
msg: Msg,
) -> Pin<Box<dyn Future<Output = Cancellable<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
peers: &'life1 [PeerId],
mux_key: MuxKey,
msg: Msg,
) -> Pin<Box<dyn Future<Output = Cancellable<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a message to a specific destination at specific peer.