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

Method contains

code/chapter09/bloom_filter.rs:44–50  ·  view source on GitHub ↗

数据查询

(&self, elem: &T)

Source from the content-addressed store, hash-verified

42
43 // 数据查询
44 fn contains(&self, elem: &T) -> bool {
45 let hashes = self.make_hash(elem);
46 (0..self.hash_fn_count).all(|fn_i| {
47 let index = self.get_index(hashes, fn_i as u64);
48 self.bits[index]
49 })
50 }
51
52 // 计算哈希
53 fn make_hash(&self, elem: &T) -> (u64, u64) {

Callers 1

mainFunction · 0.45

Calls 2

make_hashMethod · 0.45
get_indexMethod · 0.45

Tested by

no test coverage detected