pub trait DeterministicHash {
// Required method
fn deterministic_hash<H: DeterministicHasher>(&self, state: &mut H);
}
Expand description
Signals the implementor can safely be hashed in a replicatable way across platforms and process runs.
Note that the default std::hash::Hash
trait used by Rust allows for hashing that differs
across process runs, so it is not suitable for persistent caching with turbo-tasks.
It’s very important that Vc
s never implement this, since they cannot be deterministic. The
value that they wrap, however, can implement the trait.
Required Methods§
Sourcefn deterministic_hash<H: DeterministicHasher>(&self, state: &mut H)
fn deterministic_hash<H: DeterministicHasher>(&self, state: &mut H)
Adds self
’s bytes to the DeterministicHasher
’s state, in a way that is replicatable on
any platform or process run.
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.