LinkRecvStream

Trait LinkRecvStream 

Source
pub trait LinkRecvStream: Send + Sync {
    // Required methods
    fn read<'a>(
        &'a mut self,
        buf: &'a mut [u8],
    ) -> BoxFuture<'a, LinkResult<Option<usize>>>;
    fn read_to_end(
        &mut self,
        size_limit: usize,
    ) -> BoxFuture<'_, LinkResult<Vec<u8>>>;
    fn stop(&mut self, error_code: u64) -> LinkResult<()>;
    fn id(&self) -> u64;
}
Expand description

A receive stream for reading data from a peer.

Required Methods§

Source

fn read<'a>( &'a mut self, buf: &'a mut [u8], ) -> BoxFuture<'a, LinkResult<Option<usize>>>

Read data from the stream.

Source

fn read_to_end( &mut self, size_limit: usize, ) -> BoxFuture<'_, LinkResult<Vec<u8>>>

Read all data until the stream ends.

Source

fn stop(&mut self, error_code: u64) -> LinkResult<()>

Stop receiving data (signal we don’t want more).

Source

fn id(&self) -> u64

Get the stream ID.

Implementors§