Skip to main content

AsyncReadExt

Trait AsyncReadExt 

Source
pub trait AsyncReadExt: AsyncRead {
    // Provided method
    fn read_exact<'a, S: State, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize, const TIMERS: usize, const FDS: usize>(
        &'a mut self,
        ctx: &'a Context<'_, S, TASKS, TASK_SIZE, ROOT_TASK_SIZE, TIMERS, FDS>,
        buf: &'a mut [u8],
    ) -> impl Future<Output = Result<(), ReadExactError<Self::Error>>> { ... }
}
Expand description

Helper methods on top of AsyncRead, implemented for every AsyncRead.

Provided Methods§

Source

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

Fills the whole given buffer, calling AsyncRead::read until it’s done.

§Errors

Returns an error if:

  1. reading fails
  2. or if the stream is closed before the buffer is filled.
§Cancel safety

This method is not cancel safe: an unknown number of bytes may already be read into buf.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§