xx-bloomfilter

Crates.ioxx-bloomfilter
lib.rsxx-bloomfilter
version0.11.1
sourcesrc
created_at2019-07-28 23:51:37.886772
updated_at2019-07-30 19:00:24.066407
descriptionBloom filter implementation using xx hash
homepagehttps://github.com/durch/rust-xx-bloomfilter
repositoryhttps://github.com/durch/rust-xx-bloomfilter
max_upload_size
id152479
size12,639
Drazen Urch (durch)

documentation

README

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));
}
Commit count: 108

cargo fmt