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

#55 in Data structures

Download history 7017/week @ 2023-12-23 18318/week @ 2023-12-30 24318/week @ 2024-01-06 26909/week @ 2024-01-13 27718/week @ 2024-01-20 31296/week @ 2024-01-27 22075/week @ 2024-02-03 32215/week @ 2024-02-10 26295/week @ 2024-02-17 37206/week @ 2024-02-24 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 23066/week @ 2024-04-06

143,470 downloads per month
Used in 41 crates (13 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–550KB
~10K SLoC