pub trait BlockDevice<const SIZE: usize> {
    type Error: Debug;

    // Required methods
    async fn read(
        &mut self,
        block_address: u32,
        data: &mut [[u8; SIZE]]
    ) -> Result<(), Self::Error>;
    async fn write(
        &mut self,
        block_address: u32,
        data: &[[u8; SIZE]]
    ) -> Result<(), Self::Error>;
    async fn size(&mut self) -> Result<u64, Self::Error>;
}
Expand description

A trait for a block devices

This trait can be implemented multiple times to support various different block sizes.

Required Associated Types§

Required Methods§

source

async fn read( &mut self, block_address: u32, data: &mut [[u8; SIZE]] ) -> Result<(), Self::Error>

Read one or more blocks at the given block address.

source

async fn write( &mut self, block_address: u32, data: &[[u8; SIZE]] ) -> Result<(), Self::Error>

Write one or more blocks at the given block address.

source

async fn size(&mut self) -> Result<u64, Self::Error>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: BlockDevice<SIZE>, const SIZE: usize> BlockDevice<SIZE> for &mut T

§

type Error = <T as BlockDevice<SIZE>>::Error

source§

async fn read( &mut self, block_address: u32, data: &mut [[u8; SIZE]] ) -> Result<(), Self::Error>

source§

async fn write( &mut self, block_address: u32, data: &[[u8; SIZE]] ) -> Result<(), Self::Error>

source§

async fn size(&mut self) -> Result<u64, Self::Error>

Implementors§