Crates.io | bloomfilter |
lib.rs | bloomfilter |
version | 1.0.16 |
source | src |
created_at | 2014-11-26 03:03:29.614564 |
updated_at | 2024-11-05 17:44:14.552873 |
description | Bloom filter implementation |
homepage | https://github.com/jedisct1/rust-bloom-filter |
repository | https://github.com/jedisct1/rust-bloom-filter |
max_upload_size | |
id | 402 |
size | 59,638 |
A simple but fast implementation of the Bloom filter in Rust. The Bloom filter is a a space-efficient probabilistic data structure supporting dynamic set membership queries with false positives. It was introduced by Burton H. Bloom in 1970 (Bloom, 1970) and have since been increasingly used in computing applications and bioinformatics.
Library documentation with examples is available on docs.rs.
Add this to your Cargo.toml
:
[dependencies]
bloomfilter = "1"
Here is a simple example for creating a bloom filter with a false positive rate of 0.001 and query for presence of some numbers.
use bloomfilter::Bloom;
let num_items = 100000;
let fp_rate = 0.001;
let mut bloom = Bloom::new_for_fp_rate(num_items, fp_rate);
bloom.set(&10); // insert 10 in the bloom filter
bloom.check(&10); // return true
bloom.check(&20); // return false
This project is licensed under the ISC license (LICENSE or https://opensource.org/licenses/ISC).