pub trait Static: 'static {
// Required method
fn hash_static(&self, h: &mut dyn Hasher);
}Expand description
A value hashed into a TreeDef: the type of a #[tree(skip)] field (a
configuration, a hyperparameter). A different value is a different structure, so a
compiled function retraces instead of replaying a stale constant.
Implemented for integers, bool, char, (), strings, f32/f64 (by bit pattern:
-0.0 differs from 0.0), DType, Device, Duration and Option, Vec,
Box, Arc, arrays and tuples (up to 8) of them; #[derive(Static)] implements it for
user types. (Not a blanket over Hash: that would rule out the float impls.)
Required Methods§
Sourcefn hash_static(&self, h: &mut dyn Hasher)
fn hash_static(&self, h: &mut dyn Hasher)
Feeds the value to h.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".