Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 855 Bytes

README.md

File metadata and controls

35 lines (23 loc) · 855 Bytes

Build Status

rust-bloom

rust-bloom is a bloom filter implementation in rust that uses farmhash.

Example Usage

extern crate bloom;

use bloom::BloomFilter;

fn main() {
    let mut bf = BloomFilter::new(10_000, 0.02);
    bf.insert(&"hello");
    bf.insert(&"abcd");

    match bf.has(&"hello") {
        true => println!("exists"),
        _ => println!("not exists"),
    }
}

Use Cases

  • If you're writing a spider, you can do "have I discovered this URL" efficiently.
  • It's also how "this username is already taken" works on high traffic websites.

Note that there can be false positives.