bloom

Crates.iobloom
lib.rsbloom
version0.3.2
sourcesrc
created_at2014-11-20 23:17:01.846436
updated_at2016-09-13 21:36:22.014596
descriptionFast Bloom Filter and Counting Bloom Filter implementation
homepagehttps://github.com/nicklan/bloom-rs
repository
max_upload_size
id182
size54,550
Nick Lanham (nicklan)

documentation

https://docs.rs/bloom/

README

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"
Commit count: 0

cargo fmt