pub trait IP2PConnection<M>: Send + 'static {
// Required methods
fn send<'life0, 'async_trait>(
&'life0 mut self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<DynIP2PFrame<M>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn rtt(&self) -> Option<Duration>;
// Provided methods
fn connection_type(&self) -> Option<ConnectionType> { ... }
fn connection_status_updates(&self) -> Option<DynConnectionStatusUpdates> { ... }
fn into_dyn(self) -> DynP2PConnection<M>
where Self: Sized { ... }
}Required Methods§
Sourcefn send<'life0, 'async_trait>(
&'life0 mut self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a message over the connection. This is not required to be cancel-safe.
Provided Methods§
Sourcefn connection_type(&self) -> Option<ConnectionType>
fn connection_type(&self) -> Option<ConnectionType>
Get the transport type currently backing this live connection.
Sourcefn connection_status_updates(&self) -> Option<DynConnectionStatusUpdates>
fn connection_status_updates(&self) -> Option<DynConnectionStatusUpdates>
Subscribe to notifications that the live connection metadata may have changed.
Implementations should treat these as wake-ups only. The state machine
reads a fresh Self::connection_type and Self::rtt snapshot after
each notification. None means notifications are unsupported, while the
end of a returned stream means there will be no more notifications.