pub trait Connection: Send + Sync {
// Required methods
fn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ConnectionInfo> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_alive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn measure_quality<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConnectionQuality>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn local_addr(&self) -> Multiaddr;
fn remote_addr(&self) -> Multiaddr;
}
Expand description
Connection trait for active connections
Required Methods§
Sourcefn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [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 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send data over the connection
Sourcefn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive data from the connection
Sourcefn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ConnectionInfo> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ConnectionInfo> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get connection info
Sourcefn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the connection
Sourcefn is_alive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_alive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if connection is alive
Sourcefn measure_quality<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConnectionQuality>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn measure_quality<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConnectionQuality>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Measure connection quality
Sourcefn local_addr(&self) -> Multiaddr
fn local_addr(&self) -> Multiaddr
Get local address
Sourcefn remote_addr(&self) -> Multiaddr
fn remote_addr(&self) -> Multiaddr
Get remote address