Skip to main content

RollbackBuffer

Struct RollbackBuffer 

Source
pub struct RollbackBuffer { /* private fields */ }
Expand description

120-frame ring buffer for prediction/correction rollback.

Exactly 1.0 second at 120Hz. Architecturally locked — never grows. Each frame stores a FrameSnapshot that references diffs in the DiffPool.

Implementations§

Source§

impl RollbackBuffer

Source

pub fn new() -> Self

Create a new RollbackBuffer. All 120 slots zeroed.

Source

pub fn push(&mut self, snapshot: FrameSnapshot)

Record a frame snapshot. Overwrites oldest if buffer is full.

Source

pub fn find_by_tick(&self, tick: u64) -> Option<&FrameSnapshot>

Find a frame by tick number. Returns None if not in the buffer.

Source

pub fn latest(&self) -> Option<&FrameSnapshot>

Get the most recent frame snapshot.

Source

pub fn count(&self) -> usize

Number of valid frames stored.

Source

pub fn frames_forward( &self, start_tick: u64, end_tick: u64, ) -> FrameRangeIter<'_>

Iterate frames from start_tick to end_tick (inclusive) in forward order. Used for replay (old→new) after rewind.

Source

pub fn frames_reverse( &self, start_tick: u64, end_tick: u64, ) -> FrameRangeReverseIter<'_>

Iterate frames from end_tick back to start_tick (inclusive) in reverse order. Used for rewind (new→old).

Auto Trait Implementations§

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.