pub trait AsyncStreamReader {
    // Required methods
    fn read_bytes(&mut self, len: usize) -> impl Future<Output = Result<Bytes>>;
    fn read<const L: usize>(&mut self) -> impl Future<Output = Result<[u8; L]>>;
}
Expand description

A non seekable reader, e.g. a network socket.

Required Methods§

source

fn read_bytes(&mut self, len: usize) -> impl Future<Output = Result<Bytes>>

Read at most len bytes. To read to the end, pass u64::MAX.

returns an empty buffer to indicate EOF.

source

fn read<const L: usize>(&mut self) -> impl Future<Output = Result<[u8; L]>>

Read a fixed size buffer.

If there are less than L bytes available, an io::ErrorKind::UnexpectedEof error is returned.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AsyncStreamReader for &[u8]

source§

async fn read_bytes(&mut self, len: usize) -> Result<Bytes>

source§

async fn read<const L: usize>(&mut self) -> Result<[u8; L]>

source§

impl AsyncStreamReader for Bytes

source§

async fn read_bytes(&mut self, len: usize) -> Result<Bytes>

source§

async fn read<const L: usize>(&mut self) -> Result<[u8; L]>

source§

impl AsyncStreamReader for BytesMut

source§

async fn read_bytes(&mut self, len: usize) -> Result<Bytes>

source§

async fn read<const L: usize>(&mut self) -> Result<[u8; L]>

source§

impl<T: AsyncSliceReader> AsyncStreamReader for Cursor<T>

source§

async fn read_bytes(&mut self, len: usize) -> Result<Bytes>

source§

async fn read<const L: usize>(&mut self) -> Result<[u8; L]>

source§

impl<T: AsyncStreamReader> AsyncStreamReader for &mut T

source§

async fn read_bytes(&mut self, len: usize) -> Result<Bytes>

source§

async fn read<const L: usize>(&mut self) -> Result<[u8; L]>

Implementors§