2021-09-25 09:22:34 +00:00
|
|
|
/// Hash the given value with a predictable hasher.
|
|
|
|
#[inline]
|
|
|
|
pub fn hash(value: impl std::hash::Hash) -> u64 {
|
2021-10-27 06:51:34 +00:00
|
|
|
use std::hash::Hasher as _;
|
|
|
|
let mut hasher = ahash::AHasher::new_with_keys(123, 456);
|
|
|
|
value.hash(&mut hasher);
|
|
|
|
hasher.finish()
|
2021-09-25 09:22:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Hash the given value with the given hasher.
|
|
|
|
#[inline]
|
|
|
|
pub fn hash_with(value: impl std::hash::Hash, mut hasher: impl std::hash::Hasher) -> u64 {
|
|
|
|
value.hash(&mut hasher);
|
|
|
|
hasher.finish()
|
|
|
|
}
|