Skip to main content

TransactionalCheckpoint

Trait TransactionalCheckpoint 

Source
pub trait TransactionalCheckpoint {
    type State: Clone + Serialize + DeserializeOwned;

    // Required methods
    fn snapshot(&self) -> Self::State;
    fn validate_snapshot(&self, state: &Self::State) -> Result<()>;
    fn restore_validated(&mut self, state: &Self::State);
}
Expand description

Transactional state contract for a serial component.

Validation must be read-only, and restore must be infallible after matching validation succeeds.

Required Associated Types§

Source

type State: Clone + Serialize + DeserializeOwned

Owned serializable component state.

Required Methods§

Source

fn snapshot(&self) -> Self::State

Captures current component state.

Source

fn validate_snapshot(&self, state: &Self::State) -> Result<()>

Checks state compatibility without mutation.

Source

fn restore_validated(&mut self, state: &Self::State)

Restores state accepted by Self::validate_snapshot.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§