Skip to main content

AsyncRead

Trait AsyncRead 

Source
pub trait AsyncRead {
    type Error;

    // Required method
    fn read<'a, E: 'static, const EVENTS: usize, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize, const TIMERS: usize, const FDS: usize>(
        &'a mut self,
        ctx: &'a Context<'_, E, EVENTS, TASKS, TASK_SIZE, ROOT_TASK_SIZE, TIMERS, FDS>,
        buf: &'a mut [u8],
    ) -> impl Future<Output = Result<usize, Self::Error>>;
}
Expand description

A stream that can be read from asynchronously.

Required Associated Types§

Source

type Error

The error returned by read.

Required Methods§

Source

fn read<'a, E: 'static, const EVENTS: usize, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize, const TIMERS: usize, const FDS: usize>( &'a mut self, ctx: &'a Context<'_, E, EVENTS, TASKS, TASK_SIZE, ROOT_TASK_SIZE, TIMERS, FDS>, buf: &'a mut [u8], ) -> impl Future<Output = Result<usize, Self::Error>>

Reads into a given buffer, returns the number of read bytes.

Returns 0 if the stream is closed (or if the buffer is empty).

§Errors

Returns an error if reading fails.

§Cancel safety

Implementations in this crate are cancel safe.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§