pub trait BlockDevice {
    type Error: Debug;

    // Required methods
    fn read(
        &self,
        blocks: &mut [Block],
        start_block_idx: BlockIdx,
        reason: &str
    ) -> Result<(), Self::Error>;
    fn write(
        &self,
        blocks: &[Block],
        start_block_idx: BlockIdx
    ) -> Result<(), Self::Error>;
    fn num_blocks(&self) -> Result<BlockCount, Self::Error>;
}
Expand description

Represents a block device - a device which can read and write blocks (or sectors). Only supports devices which are <= 2 TiB in size.

Required Associated Types§

source

type Error: Debug

The errors that the BlockDevice can return. Must be debug formattable.

Required Methods§

source

fn read( &self, blocks: &mut [Block], start_block_idx: BlockIdx, reason: &str ) -> Result<(), Self::Error>

Read one or more blocks, starting at the given block index.

source

fn write( &self, blocks: &[Block], start_block_idx: BlockIdx ) -> Result<(), Self::Error>

Write one or more blocks, starting at the given block index.

source

fn num_blocks(&self) -> Result<BlockCount, Self::Error>

Determine how many blocks this device can hold.

Implementors§

source§

impl<SPI, CS, DELAYER> BlockDevice for SdCard<SPI, CS, DELAYER>
where SPI: SpiDevice<u8>, CS: OutputPin, DELAYER: DelayNs,

§

type Error = Error