#bloom #filter #bloomfilter

bloom

Fast Bloom Filter and Counting Bloom Filter implementation

5 unstable releases

0.3.2 Sep 13, 2016
0.3.1 Sep 13, 2016
0.3.0 Sep 13, 2016
0.2.0 Jul 15, 2016
0.0.1 Nov 20, 2014

#2 in #bloomfilter

Download history 174/week @ 2019-12-10 119/week @ 2019-12-17 41/week @ 2019-12-24 75/week @ 2019-12-31 109/week @ 2020-01-07 125/week @ 2020-01-14 121/week @ 2020-01-21 148/week @ 2020-01-28 98/week @ 2020-02-04 147/week @ 2020-02-11 124/week @ 2020-02-18 235/week @ 2020-02-25 199/week @ 2020-03-03 927/week @ 2020-03-10 1090/week @ 2020-03-17 1176/week @ 2020-03-24

545 downloads per month
Used in 38 crates (3 directly)

GPL-2.0 license

37KB
634 lines

bloom

An implementation of various Approximate Set Membership structures in Rust. Currently included are a standard Bloom Filter, and the simplest kind of Counting Bloom Filter.

At some point more advanced types of ASMSes will be added.

Basic Usage

extern crate bloom;
use bloom::BloomFilter;
let expected_num_items = 1000;
let false_positive_rate = 0.01;
let mut filter:BloomFilter = BloomFilter::with_rate(false_positive_rate,expected_num_items);
filter.insert(&1i);
filter.contains(&1i); /* true */
filter.contains(&2i); /* false */

Installation

Use Cargo and add the following to your Cargo.toml

[dependencies]
bloom="0.2.0"

Documentation

See here

False Positive Rate

The false positive rate is specified as a float in the range (0,1). If indicates that out of X probes, X * rate should return a false positive. Higher values will lead to smaller (but more inaccurate) filters.

Benchmarks

This crate includes some benchmarks to test the performance of the bloom filter. To run them you'll need to use rust nightly (the benchmark feature isn't stable yet), and then run:

cargo bench --features "do-bench"

Dependencies

~69KB