pub struct AdaptiveSnapshotter {
pub min_interval: u64,
pub max_interval: u64,
pub entropy_threshold: u32,
/* private fields */
}Expand description
Adaptive snapshot scheduler based on state entropy.
Fixed-interval snapshots create Mura (unevenness):
- Menu screens waste space with identical snapshots
- High-action moments lack granularity
Solution: Snapshot based on state entropy (magnitude of change).
Fields§
§min_interval: u64Minimum frames between snapshots.
max_interval: u64Maximum frames between snapshots (force snapshot).
entropy_threshold: u32Entropy threshold to trigger snapshot.
Implementations§
Source§impl AdaptiveSnapshotter
impl AdaptiveSnapshotter
Sourcepub const fn new(
min_interval: u64,
max_interval: u64,
entropy_threshold: u32,
) -> Self
pub const fn new( min_interval: u64, max_interval: u64, entropy_threshold: u32, ) -> Self
Create with custom parameters.
Sourcepub fn should_snapshot(
&mut self,
frame: u64,
state_hash: &[u8; 32],
) -> SnapshotDecision
pub fn should_snapshot( &mut self, frame: u64, state_hash: &[u8; 32], ) -> SnapshotDecision
Determine if a snapshot should be taken this frame.
Sourcepub const fn last_snapshot_frame(&self) -> u64
pub const fn last_snapshot_frame(&self) -> u64
Get the frame of the last snapshot.
Trait Implementations§
Source§impl Clone for AdaptiveSnapshotter
impl Clone for AdaptiveSnapshotter
Source§fn clone(&self) -> AdaptiveSnapshotter
fn clone(&self) -> AdaptiveSnapshotter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AdaptiveSnapshotter
impl Debug for AdaptiveSnapshotter
Auto Trait Implementations§
impl Freeze for AdaptiveSnapshotter
impl RefUnwindSafe for AdaptiveSnapshotter
impl Send for AdaptiveSnapshotter
impl Sync for AdaptiveSnapshotter
impl Unpin for AdaptiveSnapshotter
impl UnwindSafe for AdaptiveSnapshotter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more