pub trait TypeHash {
// Required method
fn write_hash(hasher: &mut impl Hasher);
// Provided method
fn type_hash() -> u64 { ... }
}
Expand description
A hash of a type’s structure
Required Methods§
Sourcefn write_hash(hasher: &mut impl Hasher)
fn write_hash(hasher: &mut impl Hasher)
Write the structure of the type to the hasher
Provided Methods§
Sourcefn type_hash() -> u64
fn type_hash() -> u64
Generate a stable hash of the type structure.
This recursively hashes the names and types of each variant and field, and uses an unseeded hasher to ensure the hash is stable across compilations and executions. The hash should only change if a field/variant is renamed, added, or its type is changed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.