The casserole
crate provides a custom derive and a trait to perform break-down
serialization and serialization of Rust types to into content-addressable storage.
/// Example Tree to be stored in the database
Basic usage demonstration (given big_value
as a large value to work with):
// Obtain a reference to an example store (can be persistent or in-memory).
// `JSONMemorySHA1` is like the Git database, but with base64 string as keys,
// and serde-json output as values.
let mut store = new;
// Create a our serde-ready type for the root. `stored_root` is our unique
// representation for `big_value`, but it is very small, like a 'Git hash'.
let stored_root = big_value.casserole.unwrap;
// <...do other stuff...>
// Restore the origin value from the database
let restored_big_value = decasserole.unwrap;
assert_eq!;