xref: /third_party/rust/crates/cxx/src/hash.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/cxx/src/
133d722a9Sopenharmony_ciuse core::hash::{Hash, Hasher};
233d722a9Sopenharmony_ci
333d722a9Sopenharmony_ci#[doc(hidden)]
433d722a9Sopenharmony_cipub fn hash<V: Hash>(value: &V) -> usize {
533d722a9Sopenharmony_ci    #[cfg(feature = "std")]
633d722a9Sopenharmony_ci    let mut hasher = std::collections::hash_map::DefaultHasher::new();
733d722a9Sopenharmony_ci    #[cfg(not(feature = "std"))]
833d722a9Sopenharmony_ci    let mut hasher = crate::sip::SipHasher13::new();
933d722a9Sopenharmony_ci
1033d722a9Sopenharmony_ci    Hash::hash(value, &mut hasher);
1133d722a9Sopenharmony_ci    Hasher::finish(&hasher) as usize
1233d722a9Sopenharmony_ci}
13

Indexes created Thu Nov 07 10:32:03 CST 2024