xref: /aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/vendor/cxx-1.0.120/src/hash.rs (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 use core::hash::{Hash, Hasher};
2 
3 #[doc(hidden)]
hash<V: Hash>(value: &V) -> usize4 pub 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 }
13