MockFlash

Struct MockFlash 

Source
pub struct MockFlash<const SIZE: usize> { /* private fields */ }
Expand description

Simple mock flash device with byte-level operations

Simulates EEPROM-like flash where individual bytes can be written. Initialized with all bytes set to 0xFF (erased state).

Implementations§

Source§

impl<const SIZE: usize> MockFlash<SIZE>

Source

pub const fn new() -> Self

Trait Implementations§

Source§

impl<const SIZE: usize> Debug for MockFlash<SIZE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const SIZE: usize> Default for MockFlash<SIZE>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SIZE: usize> Flash for MockFlash<SIZE>

Source§

type Error = Infallible

The error type for flash operations
Source§

fn read(&mut self, addr: u32, buf: &mut [u8]) -> Result<(), Self::Error>

Read data from flash memory at the specified byte address Read more
Source§

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

Write data to flash memory at the specified address Read more
Source§

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

Erase a flash sector or replace first byte to invalidate a slot Read more
Source§

fn erase_all(&mut self, count: usize) -> Result<(), Self::Error>

Bulk erase multiple slots/sectors Read more
Source§

impl<const SIZE: usize> PartialEq for MockFlash<SIZE>

Source§

fn eq(&self, other: &MockFlash<SIZE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const SIZE: usize> StructuralPartialEq for MockFlash<SIZE>

Auto Trait Implementations§

§

impl<const SIZE: usize> Freeze for MockFlash<SIZE>

§

impl<const SIZE: usize> RefUnwindSafe for MockFlash<SIZE>

§

impl<const SIZE: usize> Send for MockFlash<SIZE>

§

impl<const SIZE: usize> Sync for MockFlash<SIZE>

§

impl<const SIZE: usize> Unpin for MockFlash<SIZE>

§

impl<const SIZE: usize> UnwindSafe for MockFlash<SIZE>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.