mmap-bitvec
mmap-bitvec is a library for working with bit-vectors backed by memory-mapped files. Included is a simple Bloom filter built on top of such bit-vectors.
Examples
Using a memory-mapped bit-vector:
// Build an in-memory bit-vector with a capacity of 128 bits.
use ;
let mut bitvec = from_memory.unwrap;
bitvec.set;
assert!;
assert_eq!;
// Write the bit-vector to disk, passing in `None` where an optional magic bytes arg can be set
let dir = tempdir.unwrap;
bitvec.save_to_disk
.unwrap;
let f = open.unwrap;
assert_eq!;
Using the Bloom filter:
use ;
// Create a Bloom filter with a capacity of 100 bits that uses 2 hash functions on each insert.
let mut filter = new.unwrap;
let = ;
assert!;
assert!;
filter.insert;
assert!;
assert!;
License
This project is licensed under the MIT license.