cxx/
hash.rs

1use core::hash::{Hash, Hasher};
2
3#[doc(hidden)]
4pub fn hash<V: Hash>(value: &V) -> usize {
5    #[cfg(feature = "std")]
6    let mut hasher = std::collections::hash_map::DefaultHasher::new();
7    #[cfg(not(feature = "std"))]
8    let mut hasher = crate::sip::SipHasher13::new();
9
10    Hash::hash(value, &mut hasher);
11    Hasher::finish(&hasher) as usize
12}