pub trait Reader {
    type Data<'data>: Buf;
    type Error;

    // Required method
    async fn next(&mut self) -> Option<Result<Self::Data<'_>, Self::Error>>;
}
Expand description

Reader provides an abstract interface to the various async read implementations.

The goal of the reader is to read the data. It will return all the data chunks in a loop.

Required Associated Types§

source

type Data<'data>: Buf

The chunk data.

source

type Error

The error that can originate at the reader.

Required Methods§

source

async fn next(&mut self) -> Option<Result<Self::Data<'_>, Self::Error>>

Read next chunk of data. If there is no more data to read - returns None.

Implementors§

source§

impl<Inner, EofCondition> Reader for async_streamdata::reader::generic::Reader<Tokio, Inner, EofCondition, BytesMut>where Inner: AsyncRead + Unpin, EofCondition: EofCondition<Result<usize, Error>>,

§

type Data<'data> = Bytes

§

type Error = Error

source§

impl<Stream, Data, Error> Reader for async_streamdata::reader::stream::Reader<Stream>where Data: Buf, Stream: Stream<Item = Result<Data, Error>> + Unpin,

§

type Data<'data> = Data

§

type Error = Error

source§

impl<T> Reader for async_streamdata::reader::http_body::Reader<T>where T: Body + Unpin,

§

type Data<'data> = <T as Body>::Data

§

type Error = <T as Body>::Error