A simple bitset implementation.
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));
This project is licensed under either of
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
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.