pub(crate) trait PeerConnection: Send + Sync {
// Required methods
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
payload: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
) -> Pin<Box<dyn Future<Output = Result<ProtocolEvent>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Per-peer wire abstraction. Hides single-pipe (TCP/TLS) vs. stream-mux (QUIC) framing from the layers above.
Required Methods§
Sourcefn send<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
payload: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
payload: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send pre-encoded payload bytes for proto_id.
Sourcefn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
) -> Pin<Box<dyn Future<Output = Result<ProtocolEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
) -> Pin<Box<dyn Future<Output = Result<ProtocolEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Pop the next event for proto_id. Blocks until a message
arrives or shutdown is broadcast.