pub trait SyncTransport: Send + Sync {
type Error: Error + Send + Sync;
// Required methods
fn send<'a>(
&'a self,
data: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>;
fn receive(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + '_>>;
fn is_connected(&self) -> bool;
}Expand description
Transport trait for synchronization
Required Associated Types§
Required Methods§
Sourcefn send<'a>(
&'a self,
data: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>
fn send<'a>( &'a self, data: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>
Send data to remote peers
Sourcefn receive(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + '_>>
fn receive( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + '_>>
Receive data from remote peers
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if transport is connected