Crates.io | pdsa |
lib.rs | pdsa |
version | 0.1.0 |
source | src |
created_at | 2023-02-25 06:42:18.909388 |
updated_at | 2023-02-25 06:42:18.909388 |
description | Probabilistic data structures for Rust |
homepage | |
repository | https://github.com/arunma/pdsa |
max_upload_size | |
id | 794212 |
size | 28,637 |
PDSA is a collection of probabilistic data structures implemented in Rust. These data structures are useful for various applications where approximate answers or approximations to subsets are sufficient.
Currently, PDSA includes an implementation of Bloom filter, with other data structures to be added in the future releases.
Add the following line to your Cargo.toml file:
[dependencies]
pdsa = "0.1.0"
use pdsa::BloomFilter;
fn main() {
// Create a Bloom filter with 1000 items and a false positive rate of 1%
let mut bloom_filter = BloomFilter::new(1000, 0.01).unwrap();
// Insert some items into the Bloom filter
bloom_filter.insert(&"foo");
bloom_filter.insert(&"bar");
// Check if an item is in the Bloom filter
assert!(bloom_filter.contains(&"foo"));
assert!(!bloom_filter.contains(&"baz"));
}
Contributions are welcome! If you find a bug or have a feature request, please open an issue on the GitHub repository. If you would like to contribute code, please fork the repository and submit a pull request.
See CONTRIBUTING.md.
PDSA is licensed under the MIT license. See the LICENSE file for details.