pulz-bitset

Crates.iopulz-bitset
lib.rspulz-bitset
version0.1.0-alpha2
created_at2022-01-31 20:13:34.674524+00
updated_at2025-11-17 16:41:24.95921+00
descriptionA simple bitset implementation
homepage
repositoryhttps://github.com/HellButcher/pulz.git
max_upload_size
id524764
size21,442
Christoph H (HellButcher)

documentation

README

pulz-bitset

Crates.io docs.rs license: MIT/Apache-2.0 Rust CI

A simple bitset implementation.

Example

use pulz_bitset::BitSet;

let mut bitset = BitSet::new();

assert!(!bitset.contains(1));
assert!(!bitset.contains(1337));

// insert new value
assert!(bitset.insert(1337));
assert!(!bitset.contains(1));
assert!(bitset.contains(1337));

// insert an other value
assert!(bitset.insert(1));
assert!(bitset.contains(1));

// inserting an already existing value returns false
assert!(!bitset.insert(1));
// removing a value, that was not inserted
assert!(!bitset.remove(333));
// removing an inserted value
assert!(bitset.remove(1337));
// removing a value, that was already removed
assert!(!bitset.remove(1337));

assert!(bitset.contains(1));
assert!(!bitset.contains(333));
assert!(!bitset.contains(1337));

License

This project is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 0

cargo fmt