Skip to main content

ReadStream

Trait ReadStream 

pub trait ReadStream:
    Unpin
    + Send
    + Sync {
    // Required method
    fn read(
        &mut self,
    ) -> impl Future<Output = Result<Buffer, Error>> + MaybeSend;

    // Provided method
    fn read_all(
        &mut self,
    ) -> impl Future<Output = Result<Buffer, Error>> + MaybeSend { ... }
}
Expand description

ReadStream is the internal trait used by OpenDAL to stream data from storage.

Users should not use or import this trait unless they are implementing a Service.

This trait returns impl Future, so it is not object safe. Use ReadStreamDyn when type erasure is required.

Required Methods§

fn read(&mut self) -> impl Future<Output = Result<Buffer, Error>> + MaybeSend

Read the next data chunk from the stream.

Provided Methods§

fn read_all( &mut self, ) -> impl Future<Output = Result<Buffer, Error>> + MaybeSend

Read all data from the reader.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl ReadStream for ()

§

async fn read(&mut self) -> Result<Buffer, Error>

§

impl ReadStream for Bytes

§

async fn read(&mut self) -> Result<Buffer, Error>

§

impl<T> ReadStream for Box<T>
where T: ReadStreamDyn + ?Sized,

§NOTE

Take care about the deref_mut() here. This makes sure that we are calling functions upon &mut T instead of &mut Box<T>. The later could result in infinite recursion.

§

async fn read(&mut self) -> Result<Buffer, Error>

§

async fn read_all(&mut self) -> Result<Buffer, Error>

Implementors§

§

impl ReadStream for Buffer

§

impl ReadStream for HttpBody

Source§

impl ReadStream for SecureFsReadStream

§

impl<ONE, TWO, THREE, FOUR> ReadStream for FourWays<ONE, TWO, THREE, FOUR>
where ONE: ReadStream, TWO: ReadStream, THREE: ReadStream, FOUR: ReadStream,

§

impl<ONE, TWO, THREE> ReadStream for ThreeWays<ONE, TWO, THREE>
where ONE: ReadStream, TWO: ReadStream, THREE: ReadStream,

§

impl<ONE, TWO> ReadStream for TwoWays<ONE, TWO>
where ONE: ReadStream, TWO: ReadStream,