uniset

Crates.iouniset
lib.rsuniset
version0.2.4
sourcesrc
created_at2020-02-18 12:08:12.242678
updated_at2024-03-13 10:53:42.419456
descriptionA hierarchical, growable bit set with support for in-place atomic operations.
homepagehttps://github.com/udoprog/uniset
repositoryhttps://github.com/udoprog/uniset
max_upload_size
id210285
size76,449
John-John Tedro (udoprog)

documentation

https://docs.rs/uniset

README

uniset

github crates.io docs.rs build status

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.


Features

  • 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).

Examples

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());
Commit count: 23

cargo fmt