Crate pulz_bitset

Crate pulz_bitset 

Expand description

§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.

Structs§

BitSet
Bit-Set like structure
BitSetDrain
BitSetIter