ReadWrite

Trait ReadWrite 

Source
pub trait ReadWrite {
    type Error: Clone + Copy;
    type Address: Address;

    // Required methods
    fn label() -> &'static str;
    fn read(
        &mut self,
        address: Self::Address,
        bytes: &mut [u8],
    ) -> Result<(), Self::Error>;
    fn write(
        &mut self,
        address: Self::Address,
        bytes: &[u8],
    ) -> Result<(), Self::Error>;
    fn range(&self) -> (Self::Address, Self::Address);
    fn erase(&mut self) -> Result<(), Self::Error>;
    fn write_from_blocks<I: Iterator<Item = [u8; N]>, const N: usize>(
        &mut self,
        address: Self::Address,
        blocks: I,
    ) -> Result<(), Self::Error>;

    // Provided method
    fn bytes(&mut self, address: Self::Address) -> ReadIterator<'_, Self>  { ... }
}
Expand description

Reads and writes a range of bytes, generic over an address

Required Associated Types§

Required Methods§

Source

fn label() -> &'static str

An identifying name for the flash chip.

Source

fn read( &mut self, address: Self::Address, bytes: &mut [u8], ) -> Result<(), Self::Error>

Source

fn write( &mut self, address: Self::Address, bytes: &[u8], ) -> Result<(), Self::Error>

Source

fn range(&self) -> (Self::Address, Self::Address)

Source

fn erase(&mut self) -> Result<(), Self::Error>

Source

fn write_from_blocks<I: Iterator<Item = [u8; N]>, const N: usize>( &mut self, address: Self::Address, blocks: I, ) -> Result<(), Self::Error>

Provided Methods§

Source

fn bytes(&mut self, address: Self::Address) -> ReadIterator<'_, Self>

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§