27 releases (16 stable)

2.0.0 Nov 5, 2024
1.0.16 Nov 5, 2024
1.0.15 Oct 27, 2024
1.0.14 Jun 27, 2024
0.0.1 Nov 26, 2014

#46 in Data structures

Download history 31675/week @ 2024-08-03 27784/week @ 2024-08-10 32383/week @ 2024-08-17 36665/week @ 2024-08-24 31889/week @ 2024-08-31 31699/week @ 2024-09-07 27979/week @ 2024-09-14 33868/week @ 2024-09-21 26554/week @ 2024-09-28 32567/week @ 2024-10-05 31908/week @ 2024-10-12 34769/week @ 2024-10-19 28763/week @ 2024-10-26 39776/week @ 2024-11-02 40366/week @ 2024-11-09 38432/week @ 2024-11-16

153,172 downloads per month
Used in 48 crates (18 directly)

ISC license

51KB
208 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 = "2"

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

~160–560KB
~11K SLoC