Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jedisct1/rust-bloom-filter
A fast Bloom filter implementation in Rust
https://github.com/jedisct1/rust-bloom-filter
Last synced: about 2 months ago
JSON representation
A fast Bloom filter implementation in Rust
- Host: GitHub
- URL: https://github.com/jedisct1/rust-bloom-filter
- Owner: jedisct1
- License: bsd-2-clause
- Created: 2013-09-26T05:25:12.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-06-27T11:56:27.000Z (3 months ago)
- Last Synced: 2024-06-27T12:03:52.376Z (3 months ago)
- Language: Rust
- Size: 211 KB
- Stars: 217
- Watchers: 7
- Forks: 47
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bloomfilter
[![Crates.io](https://img.shields.io/crates/v/bloomfilter.svg)](https://crates.io/crates/bloomfilter)
[![docs.rs](https://docs.rs/bloomfilter/badge.svg)](https://docs.rs/bloomfilter)
[![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://github.com/jedisct1/rust-bloom-filter/blob/master/LICENSE)
A simple but fast implementation of the Bloom filter in Rust. The Bloom filter is a a space-efficient probabilistic data structure supporting dynamic set membership queries with false positives. It was introduced by Burton H. Bloom in 1970 [(Bloom, 1970)](https://dl.acm.org/doi/10.1145/362686.362692) and have since been increasingly used in computing applications and bioinformatics.
### Documentation
Library documentation with examples is available on [docs.rs](https://docs.rs/bloomfilter).
### Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
bloomfilter = "1"
```Here is a simple example for creating a bloom filter with a false positive rate of 0.001 and query for presence of some numbers.
```rust
use bloomfilter::Bloom;let num_items = 100000;
let fp_rate = 0.001;let mut bloom = Bloom::new_for_fp_rate(num_items, fp_rate);
bloom.set(&10); // insert 10 in the bloom filter
bloom.check(&10); // return true
bloom.check(&20); // return false
```### License
This project is licensed under the ISC license ([LICENSE](https://github.com/jedisct1/rust-bloom-filter/blob/master/LICENSE) or https://opensource.org/licenses/ISC).