pub trait AsyncStreamReader {
    type ReadFuture<'a>: Future<Output = Result<Bytes>> + 'a
       where Self: 'a;

    // Required method
    fn read(&mut self, len: usize) -> Self::ReadFuture<'_>;
}
Expand description

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

Required Associated Types§

source

type ReadFuture<'a>: Future<Output = Result<Bytes>> + 'a where Self: 'a

Future returned by read

Required Methods§

source

fn read(&mut self, len: usize) -> Self::ReadFuture<'_>

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

returns an empty buffer to indicate EOF.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AsyncStreamReader for Bytes

§

type ReadFuture<'a> = Ready<Result<Bytes, Error>>

source§

fn read(&mut self, len: usize) -> Self::ReadFuture<'_>

source§

impl<T: AsyncStreamReader> AsyncStreamReader for &mut T

§

type ReadFuture<'a> = <T as AsyncStreamReader>::ReadFuture<'a> where Self: 'a

source§

fn read(&mut self, len: usize) -> Self::ReadFuture<'_>

Implementors§