subspace_farmer_components

Trait ReadAtAsync

source
pub trait ReadAtAsync {
    // Required method
    fn read_at<B>(&self, buf: B, offset: u64) -> impl Future<Output = Result<B>>
       where AsyncReadBytes<B>: From<B>,
             B: AsMut<[u8]> + Unpin + 'static;

    // Provided method
    fn offset(&self, offset: u64) -> ReadAtOffset<'_, Self>
       where Self: Sized { ... }
}
Expand description

Async version of ReadAt, it is neither Send nor Sync and is supposed to be used with concurrent async combinators

Required Methods§

source

fn read_at<B>(&self, buf: B, offset: u64) -> impl Future<Output = Result<B>>
where AsyncReadBytes<B>: From<B>, B: AsMut<[u8]> + Unpin + 'static,

Fill the buffer by reading bytes at a specific offset and return the buffer back

Provided Methods§

source

fn offset(&self, offset: u64) -> ReadAtOffset<'_, Self>
where Self: Sized,

Get implementation of ReadAtAsync that add specified offset to all attempted reads

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.

Implementations on Foreign Types§

source§

impl ReadAtAsync for !

source§

async fn read_at<B>(&self, _buf: B, _offset: u64) -> Result<B>
where AsyncReadBytes<B>: From<B>, B: AsMut<[u8]> + Unpin + 'static,

Implementors§

source§

impl<T> ReadAtAsync for &ReadAtOffset<'_, T>
where T: ReadAtAsync,

source§

impl<T> ReadAtAsync for ReadAtOffset<'_, T>
where T: ReadAtAsync,