5 unstable releases

Uses old Rust 2015

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

#2002 in Data structures

Download history 2237/week @ 2024-03-14 1077/week @ 2024-03-21 1231/week @ 2024-03-28 1068/week @ 2024-04-04 848/week @ 2024-04-11 743/week @ 2024-04-18 695/week @ 2024-04-25 955/week @ 2024-05-02 659/week @ 2024-05-09 847/week @ 2024-05-16 760/week @ 2024-05-23 888/week @ 2024-05-30 1345/week @ 2024-06-06 782/week @ 2024-06-13 741/week @ 2024-06-20 616/week @ 2024-06-27

3,675 downloads per month
Used in 22 crates (9 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

~97KB