3 unstable releases
Uses old Rust 2015
0.11.1 | Jul 30, 2019 |
---|---|
0.11.0 | Jul 30, 2019 |
0.10.0 | Jul 28, 2019 |
#12 in #xx-hash
32 downloads per month
12KB
231 lines
xx-bloomfilter
Hard fork of https://github.com/jedisct1/rust-bloom-filter. Reworked the most of the internals to make tbe algorithm cleaner and more efficient. Uses extremly fast XxHash64 for hashing.
Usage
In your Cargo.toml
[dependencies]
xx-bloomfilter = "0.10.0"
Initialize with expected number of items and a wanted false positive rates
extern crate xx_bloomfilter;
extern crate rand;
use xx_bloomfilter::Bloom;
fn main () {
let mut bloom = Bloom::new_with_rate(1_000_000, 1e-6);
let item: u64 = rand::random();
assert_eq!(false, bloom.check_and_add(&item));
assert_eq!(true, bloom.check(&item));
// Clear all values
bloom.clear();
assert_eq!(false, bloom.check_and_add(&item));
}
lib.rs
:
Bloom filter for Rust - forked from https://github.com/jedisct1/rust-bloom-filter
This is a simple but fast Bloom filter implementation, that requires only 2 hash functions, generated with XXHash64 using randomized keys.
Dependencies
~1.7–2.5MB
~45K SLoC