Trait BufferBackend

Source
pub trait BufferBackend {
    // Required methods
    fn with_data<F>(&self, from: usize, to: usize, f: F) -> Result<(), Error>
       where F: FnMut(&[u8]) -> Result<(), Error>;
    fn with_data_mut<F>(
        &mut self,
        from: usize,
        to: usize,
        f: F,
    ) -> Result<(), Error>
       where F: FnMut(&mut [u8]) -> Result<(), Error>;
    fn size(&self) -> usize;
}
Expand description

Trait representing a buffer backend for the NOR flash memory.

Required Methods§

Source

fn with_data<F>(&self, from: usize, to: usize, f: F) -> Result<(), Error>
where F: FnMut(&[u8]) -> Result<(), Error>,

Executes a closure with a slice of data from the buffer.

Source

fn with_data_mut<F>( &mut self, from: usize, to: usize, f: F, ) -> Result<(), Error>
where F: FnMut(&mut [u8]) -> Result<(), Error>,

Executes a closure with a mutable slice of data from the buffer.

Source

fn size(&self) -> usize

Returns the size of the buffer.

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 BufferBackend for Vec<u8>

Source§

fn with_data<F>(&self, from: usize, to: usize, f: F) -> Result<(), Error>
where F: FnMut(&[u8]) -> Result<(), Error>,

Source§

fn with_data_mut<F>( &mut self, from: usize, to: usize, f: F, ) -> Result<(), Error>
where F: FnMut(&mut [u8]) -> Result<(), Error>,

Source§

fn size(&self) -> usize

Implementors§