28 releases (17 stable)

3.0.1 Dec 2, 2024
2.0.0 Nov 5, 2024
1.0.16 Nov 5, 2024
1.0.14 Jun 27, 2024
0.0.1 Nov 26, 2014

#45 in Data structures

Download history 35433/week @ 2024-08-23 31324/week @ 2024-08-30 32934/week @ 2024-09-06 27922/week @ 2024-09-13 33704/week @ 2024-09-20 27861/week @ 2024-09-27 31020/week @ 2024-10-04 31214/week @ 2024-10-11 35798/week @ 2024-10-18 32753/week @ 2024-10-25 32458/week @ 2024-11-01 41385/week @ 2024-11-08 40421/week @ 2024-11-15 27073/week @ 2024-11-22 33858/week @ 2024-11-29 29902/week @ 2024-12-06

140,956 downloads per month
Used in 48 crates (18 directly)

ISC license

52KB
446 lines

bloomfilter

Crates.io docs.rs License: ISC

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.

Documentation

Library documentation is available on docs.rs.

Usage

Add this to your Cargo.toml:

[dependencies]
bloomfilter = "3"

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).unwrap();
bloom.set(&10);   // insert 10 in the bloom filter
bloom.check(&10); // return true
bloom.check(&20); // return false

License

This project is licensed under the ISC license (LICENSE or https://opensource.org/licenses/ISC).

Dependencies

~56–465KB