Skip to main content

ReadableStream

Trait ReadableStream 

Source
pub trait ReadableStream: Send {
    // Required methods
    fn read_into(
        &mut self,
        buffer: &mut [u8],
        cancellation: &Cancellation,
    ) -> impl Future<Output = OperationResult<usize>> + Send;
    fn close(&mut self) -> impl Future<Output = Result<()>> + Send;
}
Expand description

A sequential input direction. A nonempty read returns zero at EOF. Independent input and output directions must be able to make progress.

Required Methods§

Source

fn read_into( &mut self, buffer: &mut [u8], cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<usize>> + Send

Read a possibly short prefix. Empty storage does not establish EOF.

Source

fn close(&mut self) -> impl Future<Output = Result<()>> + Send

Retire this direction. Transport ownership and final closure are separate.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§