pub trait CanonicalWrite {
// Required method
fn canonical_write(&self, out: &mut StateHasher);
}Expand description
Values with one frozen canonical byte representation.
An implementation must be self-delimiting: the shape of its writes (which
primitive writes, in what order) may depend only on values it has already
written. Write a length (with StateHasher::bytes,
StateHasher::sequence or StateHasher::length) before
variable-length data, and a tag before an optional value or enum variant.
Otherwise distinct values encode alike: if Slot(Option<u32>) writes its
u32 only when Some, sequence(&[Slot(None), Slot(Some(5))]) and
sequence(&[Slot(Some(5)), Slot(None)]) hash the same.
Required Methods§
Sourcefn canonical_write(&self, out: &mut StateHasher)
fn canonical_write(&self, out: &mut StateHasher)
Writes this value using its documented canonical byte representation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".