Skip to main content

StreamReader

Trait StreamReader 

Source
pub trait StreamReader: Stream<Item = StreamResult<Self::Output>> {
    type Output;
    type Info;

    // Required methods
    fn info(&self) -> &Self::Info;
    fn read_all(self) -> impl Future<Output = StreamResult<Self::Output>> + Send;
}
Expand description

Reader for an incoming data stream.

The stream being read from is kept open as long as its reader exists; dropping the reader will close the stream.

Required Associated Types§

Source

type Output

Type of output this reader produces.

Source

type Info

Information about the underlying data stream.

Required Methods§

Source

fn info(&self) -> &Self::Info

Returns a reference to the stream info.

Source

fn read_all(self) -> impl Future<Output = StreamResult<Self::Output>> + Send

Reads all incoming chunks from the byte stream, concatenating them into a single value which is returned once the stream closes normally.

Returns the data consisting of all concatenated chunks.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§