布隆过滤器
| 6 | |
| 7 | // 布隆过滤器 |
| 8 | struct BloomFilter<T: ?Sized> { |
| 9 | bits: Vec<bool>, // 比特桶 |
| 10 | hash_fn_count: usize, // 哈希函数个数 |
| 11 | hashers: [DefaultHasher; 2], // 两个哈希函数 |
| 12 | _phantom: PhantomData<T>, // T 占位,欺骗编译器 |
| 13 | } |
| 14 | |
| 15 | impl<T: ?Sized + Hash> BloomFilter<T> { |
| 16 | fn new(cap: usize, ert: f64) -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected