pub struct DiffPool { /* private fields */ }Expand description
Pre-allocated 1.1MB ring buffer of WavDiff entries.
Never grows. When full, oldest entries are overwritten. At 120Hz with ~100 diffs/frame, this holds ~640 frames (~5.3 seconds) of history — well beyond the 120-frame rollback window.
Implementations§
Source§impl DiffPool
impl DiffPool
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new pre-allocated DiffPool. All slots zeroed. Single heap allocation at boot — never grows.
Sourcepub fn push(&mut self, diff: WavDiff) -> u32
pub fn push(&mut self, diff: WavDiff) -> u32
Append a diff to the ring buffer. Returns the absolute index. O(1), no allocation.
Sourcepub fn get(&self, index: u32) -> Option<&WavDiff>
pub fn get(&self, index: u32) -> Option<&WavDiff>
Get a diff by absolute index. Returns None if index is out of range.
Sourcepub fn frame_diffs(&self, start: u32, count: u16) -> FrameDiffIter<'_> ⓘ
pub fn frame_diffs(&self, start: u32, count: u16) -> FrameDiffIter<'_> ⓘ
Iterate diffs for a frame given start index and count.
Handles ring buffer wrap-around.
Sourcepub fn frame_diffs_reverse(
&self,
start: u32,
count: u16,
) -> FrameDiffReverseIter<'_> ⓘ
pub fn frame_diffs_reverse( &self, start: u32, count: u16, ) -> FrameDiffReverseIter<'_> ⓘ
Iterate diffs for a frame in reverse order (for rewind).
Traverses from start + count - 1 back to start.
Auto Trait Implementations§
impl Freeze for DiffPool
impl RefUnwindSafe for DiffPool
impl Send for DiffPool
impl Sync for DiffPool
impl Unpin for DiffPool
impl UnsafeUnpin for DiffPool
impl UnwindSafe for DiffPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more