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§
Sourcefn read<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> BoxFuture<'a, LinkResult<Option<usize>>>
fn read<'a>( &'a mut self, buf: &'a mut [u8], ) -> BoxFuture<'a, LinkResult<Option<usize>>>
Read data from the stream.
Sourcefn read_to_end(
&mut self,
size_limit: usize,
) -> BoxFuture<'_, LinkResult<Vec<u8>>>
fn read_to_end( &mut self, size_limit: usize, ) -> BoxFuture<'_, LinkResult<Vec<u8>>>
Read all data until the stream ends.
Sourcefn stop(&mut self, error_code: u64) -> LinkResult<()>
fn stop(&mut self, error_code: u64) -> LinkResult<()>
Stop receiving data (signal we don’t want more).