pub trait Fingerprint {
// Required method
fn fingerprint(&self, hasher: &mut Hasher);
}Expand description
A value whose contents can be reduced to a number that two processes will agree on.
Derive it with #[derive(Fingerprint)], which walks a struct’s fields in
declaration order, or an enum’s variant index followed by its fields. Every
field’s type has to implement it too.
Required Methods§
Sourcefn fingerprint(&self, hasher: &mut Hasher)
fn fingerprint(&self, hasher: &mut Hasher)
Folds self into hasher.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Fingerprint for ()
impl Fingerprint for ()
fn fingerprint(&self, _hasher: &mut Hasher)
Source§impl Fingerprint for String
impl Fingerprint for String
fn fingerprint(&self, hasher: &mut Hasher)
Source§impl Fingerprint for bool
impl Fingerprint for bool
fn fingerprint(&self, hasher: &mut Hasher)
Source§impl Fingerprint for char
impl Fingerprint for char
fn fingerprint(&self, hasher: &mut Hasher)
Source§impl Fingerprint for f32
Floats fingerprint by their bit pattern, so NaN matches itself and 0.0
does not match -0.0 — the opposite of what == says in both cases. The
question a fingerprint answers is “are these the same state?”, not “are
these numerically equal?”.
impl Fingerprint for f32
Floats fingerprint by their bit pattern, so NaN matches itself and 0.0
does not match -0.0 — the opposite of what == says in both cases. The
question a fingerprint answers is “are these the same state?”, not “are
these numerically equal?”.