embedded_shadow/
types.rs

1use crate::ShadowError;
2
3/// Buffer for staging writes before committing to the shadow table.
4pub trait StagingBuffer {
5    /// Returns true if any writes are staged.
6    fn any_staged(&self) -> bool;
7    /// Applies staged writes to the output buffer for the given address range.
8    fn apply_overlay(&self, addr: u16, out: &mut [u8]) -> Result<(), ShadowError>;
9    /// Stages a write to be applied on commit.
10    fn write_staged(&mut self, addr: u16, data: &[u8]) -> Result<(), ShadowError>;
11    /// Clears all staged writes.
12    fn clear_staged(&mut self) -> Result<(), ShadowError>;
13    /// Iterates over all staged writes in order.
14    fn for_each_staged<F>(&self, f: F) -> Result<(), ShadowError>
15    where
16        F: FnMut(u16, &[u8]) -> Result<(), ShadowError>;
17}