Skip to main content

AsyncBlockBackend

Trait AsyncBlockBackend 

Source
pub trait AsyncBlockBackend: Send + Sync {
    // Required methods
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sector: u64,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn write<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sector: u64,
        buf: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn capacity(&self) -> u64;
    fn is_read_only(&self) -> bool;
}
Expand description

Async block I/O backend trait.

Required Methods§

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, sector: u64, buf: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Reads data from the given sector.

Source

fn write<'life0, 'life1, 'async_trait>( &'life0 self, sector: u64, buf: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Writes data to the given sector.

Source

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Flushes pending writes.

Source

fn capacity(&self) -> u64

Returns the capacity in sectors.

Source

fn is_read_only(&self) -> bool

Returns whether the device is read-only.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§