Trait FramedConnection

Source
pub trait FramedConnection: Send + Sync {
    // Required methods
    fn send_frame<'life0, 'async_trait>(
        &'life0 self,
        data: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn recv_frame<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A framed, length-delimited, duplex connection. Multiplexing is layered above this.

Required Methods§

Source

fn send_frame<'life0, 'async_trait>( &'life0 self, data: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send one frame.

Source

fn recv_frame<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive one frame. Returns None on EOF.

Source

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close half or full connection gracefully.

Implementors§