checkpoint
Provides checkpointing of application data for the Rust Programming Language.
Please see the API documentation for details.
Example Usage:
// Checkpoint data is serialized and deserialized with the Serde library.
extern crate serde;
extern crate serde_derive;
use DeserializeOwned;
use Serialize;
extern crate checkpoint;
use Result;
use ;
use ChecksumWrapper;
// Any type implementing the Serialize and DeserializeOwned traits can be checkpointed.
// Create the data that will be stored in a checkpoint.
let person = Person ;
// Create a MemoryStorage object to hold checkpoint data.
let storage = new?;
// Add integrity checks to checkpoint data with a ChecksumWrapper.
let mut wrapped_storage = wrap;
// Create a new checkpoint.
let mut uncommitted_checkpoint = wrapped_storage.create_checkpoint?;
// Add data to the checkpoint.
uncommitted_checkpoint.put?;
// Commit the checkpoint.
let mut committed_checkpoint = wrapped_storage.commit_checkpoint?;
// Retrieve the checkpoint data.
let stored_person: Person = committed_checkpoint.get?;
// The data retrieved from the checkpoint is the same as what was put in.
assert_eq!;
assert_eq!;