Trait xwt_core::stream::Read

source ·
pub trait Read: Send {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn read(
        &mut self,
        buf: &mut [u8]
    ) -> impl Future<Output = Result<Option<usize>, Self::Error>> + Send;
}
Expand description

Read the data from the stream.

Required Associated Types§

source

type Error: Error + Send + Sync + 'static

An error that can occur while reading the stream.

Required Methods§

source

fn read( &mut self, buf: &mut [u8] ) -> impl Future<Output = Result<Option<usize>, Self::Error>> + Send

Read the data from the stream into a given buffer and return the amount of bytes filled in the buffer or None if the stream is closed and does not have any pending unread data.

Object Safety§

This trait is not object safe.

Implementors§