Crates.io | uniset |
lib.rs | uniset |
version | 0.2.4 |
source | src |
created_at | 2020-02-18 12:08:12.242678 |
updated_at | 2024-03-13 10:53:42.419456 |
description | A hierarchical, growable bit set with support for in-place atomic operations. |
homepage | https://github.com/udoprog/uniset |
repository | https://github.com/udoprog/uniset |
max_upload_size | |
id | 210285 |
size | 76,449 |
A hierarchical, growable bit set with support for in-place atomic operations.
The idea is based on hibitset, but dynamically growing instead of using a fixed capacity. By being careful with the data layout, we can also support structural sharing between the local and atomic bitset variants.
vec-safety
- Avoid relying on the assumption that &mut Vec<T>
can be
safely coerced to &mut Vec<U>
if T
and U
have an identical memory
layouts (enabled by default, issue #1).use uniset::BitSet;
let mut set = BitSet::new();
assert!(set.is_empty());
assert_eq!(0, set.capacity());
set.set(127);
set.set(128);
assert!(!set.is_empty());
assert!(set.test(128));
assert_eq!(vec![127, 128], set.iter().collect::<Vec<_>>());
assert!(!set.is_empty());
assert_eq!(vec![127, 128], set.drain().collect::<Vec<_>>());
assert!(set.is_empty());