pub struct CheckpointStore<S: Clone> { /* private fields */ }Expand description
Keeps the single most recent Checkpoint for S, auto-incrementing the version on every
CheckpointStore::save. Suited for a “last confirmed state” rewind point on a long-running
engine.
Implementations§
Source§impl<S: Clone> CheckpointStore<S>
impl<S: Clone> CheckpointStore<S>
pub fn new() -> Self
Sourcepub fn save(&mut self, state: &S, timestamp: i64) -> u32
pub fn save(&mut self, state: &S, timestamp: i64) -> u32
Captures state as the new latest checkpoint, replacing any prior one.
pub fn latest(&self) -> Option<&Checkpoint<S>>
Sourcepub fn restore_into(&self, target: &mut S) -> bool
pub fn restore_into(&self, target: &mut S) -> bool
Restores target from the latest checkpoint, if one exists.
Trait Implementations§
Source§impl<S: Clone + Clone> Clone for CheckpointStore<S>
impl<S: Clone + Clone> Clone for CheckpointStore<S>
Source§fn clone(&self) -> CheckpointStore<S>
fn clone(&self) -> CheckpointStore<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<S> Freeze for CheckpointStore<S>
impl<S> RefUnwindSafe for CheckpointStore<S>
impl<S> Send for CheckpointStore<S>
impl<S> Sync for CheckpointStore<S>
impl<S> Unpin for CheckpointStore<S>
impl<S> UnsafeUnpin for CheckpointStore<S>
impl<S> UnwindSafe for CheckpointStore<S>
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