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§
Sourcetype State: Clone + Serialize + DeserializeOwned
type State: Clone + Serialize + DeserializeOwned
Owned serializable component state.
Required Methods§
Sourcefn validate_snapshot(&self, state: &Self::State) -> Result<()>
fn validate_snapshot(&self, state: &Self::State) -> Result<()>
Checks state compatibility without mutation.
Sourcefn restore_validated(&mut self, state: &Self::State)
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".