pub struct Checkpoint {
pub time: SimTime,
pub step: u64,
pub data: Vec<u8>,
pub hash: [u8; 32],
pub rng_state: RngState,
}Expand description
Checkpoint with compressed state.
Fields§
§time: SimTimeSimulation time at checkpoint.
step: u64Step count at checkpoint.
data: Vec<u8>Compressed state data.
hash: [u8; 32]Blake3 hash for integrity verification.
rng_state: RngStateRNG state for replay.
Implementations§
Source§impl Checkpoint
impl Checkpoint
Sourcepub fn create(
time: SimTime,
step: u64,
state: &SimState,
rng_state: RngState,
compression_level: i32,
) -> SimResult<Self>
pub fn create( time: SimTime, step: u64, state: &SimState, rng_state: RngState, compression_level: i32, ) -> SimResult<Self>
Sourcepub fn restore(&self) -> SimResult<SimState>
pub fn restore(&self) -> SimResult<SimState>
Restore state from checkpoint.
§Errors
Returns error if integrity check fails or deserialization fails.
Sourcepub fn compressed_size(&self) -> usize
pub fn compressed_size(&self) -> usize
Get compressed size in bytes.
Trait Implementations§
Source§impl Clone for Checkpoint
impl Clone for Checkpoint
Source§fn clone(&self) -> Checkpoint
fn clone(&self) -> Checkpoint
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 Checkpoint
impl Debug for Checkpoint
Source§impl<'de> Deserialize<'de> for Checkpoint
impl<'de> Deserialize<'de> for Checkpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Checkpoint
impl RefUnwindSafe for Checkpoint
impl Send for Checkpoint
impl Sync for Checkpoint
impl Unpin for Checkpoint
impl UnsafeUnpin for Checkpoint
impl UnwindSafe for Checkpoint
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