SyncTransport

Trait SyncTransport 

Source
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§

Source

fn send<'a>( &'a self, data: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>

Send data to remote peers

Source

fn receive( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + '_>>

Receive data from remote peers

Source

fn is_connected(&self) -> bool

Check if transport is connected

Implementors§