23 releases (12 stable)

1.0.13 Dec 15, 2023
1.0.12 Aug 23, 2023
1.0.9 Sep 9, 2021
1.0.5 Mar 19, 2021
0.0.1 Nov 26, 2014

#53 in Data structures

Download history 35257/week @ 2024-03-02 32883/week @ 2024-03-09 38957/week @ 2024-03-16 37878/week @ 2024-03-23 41577/week @ 2024-03-30 28655/week @ 2024-04-06 41583/week @ 2024-04-13 43293/week @ 2024-04-20 41372/week @ 2024-04-27 32384/week @ 2024-05-04 40615/week @ 2024-05-11 37928/week @ 2024-05-18 40503/week @ 2024-05-25 48204/week @ 2024-06-01 42085/week @ 2024-06-08 26278/week @ 2024-06-15

163,631 downloads per month
Used in 45 crates (15 directly)

ISC license

50KB
190 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 with examples is available on docs.rs.

Usage

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

License

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

Dependencies

~130–540KB
~10K SLoC