Crates.io | dense_bitset |
lib.rs | dense_bitset |
version | 0.1.1 |
source | src |
created_at | 2019-12-16 12:40:59.141742 |
updated_at | 2019-12-19 14:25:32.285879 |
description | A variably sized, heap allocated, dense bitset implemented using no `unsafe` code. |
homepage | |
repository | https://github.com/lcnr/dense_bitset |
max_upload_size | |
id | 189745 |
size | 23,845 |
A dense bitset implemented in rust
using only safe code.
use dense_bitset::BitSet;
let mut set = BitSet::new();
set.insert(7);
set.set(4, true);
set.flip(5);
assert_eq!(set, [7, 4, 5].iter().collect());
set.remove(7);
set.flip(4);
set.set(5, false);
assert!(set.is_empty());
let a: BitSet = [2, 5, 12, 17].iter().collect();
let b: BitSet = [2, 12].iter().collect();
assert!(!a.is_disjoint(&b));
assert!(b.is_subset(&a));
assert!(a.is_superset(&b));