Skip to main content

Crate hashstash

Crate hashstash 

Source

Structs§

HashCache
HashCache is a wrapper around a Stashable object that caches the hash value of that object between repeated non-mutable accesses. Mutably accessing the stored object invalidates the cached hash value, which is only recomputed as needed.
HashCacheProperty
HashCacheProperty is the cached result of a function call that is only evaluated lazily whenever the inputs have changed, according to their ObjectHash.
InplaceUnstasher
Struct for unstashing and deserializing by modifying existing objects. This struct is passed to UnstashableInplace::unstash_inplace
ObjectHash
A small and fixed-size summary of the contents to an object, such that changes to an object result in a different ObjectHash.
Stash
A container storing the serialized contents of stashed objects in a deduplicated manner, with which new objects can recreated from past snapshots and with which existing objects can be rolled back to a different state.
StashHandle
A handle to a shared stashed object living in a Stash. Holding this handle ensures that the stash object is not cleaned up, and dropping this handle may result in the stashed object being removed from the stash.
Stasher
A stasher is used to visit the contents of an object as part of its Stashable::stash implementation, interchangeably to both hash and to serialize those contents.
Unstasher
Struct for unstashing and deserializing by creating new objects. This struct is passed to Unstashable::unstash

Enums§

Order
Whether order matters for an array of stashed objects
PrimitiveType
Enum for the set of primitive fixed-size types that are supported
RoundTripError
Errors that can happen during one of the round trip tests, which indicate a bug in an object’s stashing and unstashing implementations. See each variant’s documentation for explanations about how these bugs can be fixed.
UnstashError
Error that can happen while unstashing an object
ValueType
Enum for set the of value types that are supported

Traits§

Stashable
Trait for hashing and serializing an object
Unstashable
Trait for objects that can be unstashed or deserialized by creating a new object.
UnstashableInplace
Trait for objects that can be unstashed or deserialized by modifying an existing object.

Functions§

stash_clone
Stash an object and immediately unstash it out-of-place, effectively performing a deep clone of the object. This can be used where implementing Clone is difficult (e.g. involving trait objects and factories) and/or would duplicate logic already needed for stashing and unstashing.
stash_clone_proxy
stash_clone_proxy_with_context
stash_clone_with_context
test_stash_roundtrip
Perform an end-to-end test of a Stashable object which implements Unstashable. The given create function must produce a new instance of the desired object type and the given modify function must mutate that same object such that it is logically distinct afterwards and hashes to a different value. See RoundTripError for possible failures and their explanations.
test_stash_roundtrip_inplace
Perform an end-to-end test of a Stashable object which implements UnstashableInplace. The given create function must produce a new instance of the desired object type and the given modify function must mutate that same object such that it is logically distinct afterwards and hashes to a different value. See RoundTripError for possible failures and their explanations.