MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / get_hash

Method get_hash

code/chapter09/cuckoofilter/src/util.rs:44–49  ·  view source on GitHub ↗
(elem: &T)

Source from the content-addressed store, hash-verified

42 }
43
44 fn get_hash<T: ?Sized + Hash, H: Hasher + Default>(elem: &T) -> (u32, u32) {
45 let mut hasher = <H as Default>::default();
46 elem.hash(&mut hasher);
47 let res = hasher.finish();
48 ((res >> 32) as u32, res as u32)
49 }
50
51 fn fn random_index<R: rand::Rng>(&self, r: &mut R) -> usize {
52 if r.gen() {

Callers

nothing calls this directly

Calls 1

hashMethod · 0.45

Tested by

no test coverage detected