embedded-shadow 0.1.2

Zero-alloc shadow register table with dirty tracking for embedded systems
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::ShadowError;

/// Buffer for staging writes before committing to the shadow table.
pub trait StagingBuffer {
    /// Returns true if any writes are staged.
    fn any_staged(&self) -> bool;
    /// Applies staged writes to the output buffer for the given address range.
    fn apply_overlay(&self, addr: u16, out: &mut [u8]) -> Result<(), ShadowError>;
    /// Stages a write to be applied on commit.
    fn write_staged(&mut self, addr: u16, data: &[u8]) -> Result<(), ShadowError>;
    /// Clears all staged writes.
    fn clear_staged(&mut self) -> Result<(), ShadowError>;
    /// Iterates over all staged writes in order.
    fn for_each_staged<F>(&self, f: F) -> Result<(), ShadowError>
    where
        F: FnMut(u16, &[u8]) -> Result<(), ShadowError>;
}