Skip to content

Latest commit

 

History

History

bitset

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

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.