AsyncReadAtExt

Trait AsyncReadAtExt 

pub trait AsyncReadAtExt: AsyncReadAt {
    // Provided methods
    async fn read_exact_at<T>(&self, buf: T, pos: u64) -> BufResult<(), T>
       where T: IoBufMut { ... }
    async fn read_to_string_at(
        &mut self,
        buf: String,
        pos: u64,
    ) -> BufResult<usize, String> { ... }
    async fn read_to_end_at<A>(
        &self,
        buffer: Vec<u8, A>,
        pos: u64,
    ) -> BufResult<usize, Vec<u8, A>>
       where A: Allocator + 'static { ... }
    async fn read_vectored_exact_at<T>(
        &self,
        buf: T,
        pos: u64,
    ) -> BufResult<(), T>
       where T: IoVectoredBufMut { ... }
}
Available on crate feature io only.
Expand description

Implemented as an extension trait, adding utility methods to all AsyncReadAt types. Callers will tend to import this trait instead of AsyncReadAt.

Provided Methods§

async fn read_exact_at<T>(&self, buf: T, pos: u64) -> BufResult<(), T>
where T: IoBufMut,

Read the exact number of bytes required to fill buffer.

This function reads as many bytes as necessary to completely fill the uninitialized space of specified buffer.

§Errors

If this function encounters an “end of file” before completely filling the buffer, it returns an error of the kind ErrorKind::UnexpectedEof. The contents of buffer are unspecified in this case.

If any other read error is encountered then this function immediately returns. The contents of buffer are unspecified in this case.

If this function returns an error, it is unspecified how many bytes it has read, but it will never read more than would be necessary to completely fill the buffer.

async fn read_to_string_at( &mut self, buf: String, pos: u64, ) -> BufResult<usize, String>

Read all bytes as String until EOF in this source, placing them into buffer.

async fn read_to_end_at<A>( &self, buffer: Vec<u8, A>, pos: u64, ) -> BufResult<usize, Vec<u8, A>>
where A: Allocator + 'static,

Read all bytes until EOF in this source, placing them into buffer.

All bytes read from this source will be appended to the specified buffer buffer. This function will continuously call read_at() to append more data to buffer until read_at() returns Ok(0).

If successful, this function will return the total number of bytes read.

async fn read_vectored_exact_at<T>(&self, buf: T, pos: u64) -> BufResult<(), T>

Like AsyncReadExt::read_vectored_exact, expect that it reads at a specified position.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<A> AsyncReadAtExt for A
where A: AsyncReadAt + ?Sized,