#bitset #containers

uniset

A hierarchical, growable bit set with support for in-place atomic operations

4 releases

0.2.3 Mar 22, 2023
0.2.2 Mar 22, 2023
0.2.1 Jan 2, 2023
0.2.0 Jun 4, 2020
0.1.1 Feb 18, 2020

#312 in Algorithms

Download history 35/week @ 2023-02-01 28/week @ 2023-02-08 41/week @ 2023-02-15 30/week @ 2023-02-22 11/week @ 2023-03-01 29/week @ 2023-03-08 163/week @ 2023-03-15 119/week @ 2023-03-22 29/week @ 2023-03-29 35/week @ 2023-04-05 168/week @ 2023-04-12 37/week @ 2023-04-19 41/week @ 2023-04-26 49/week @ 2023-05-03 130/week @ 2023-05-10 56/week @ 2023-05-17

280 downloads per month
Used in unicycle

MIT/Apache

53KB
874 lines

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());

No runtime deps