#bit-set #container #memory-layout

uniset

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

5 releases

0.2.4 Mar 13, 2024
0.2.3 Mar 22, 2023
0.2.1 Jan 2, 2023
0.2.0 Jun 4, 2020
0.1.1 Feb 18, 2020

#253 in Algorithms

Download history 1750/week @ 2024-09-22 1615/week @ 2024-09-29 1505/week @ 2024-10-06 2722/week @ 2024-10-13 1442/week @ 2024-10-20 2579/week @ 2024-10-27 2250/week @ 2024-11-03 2685/week @ 2024-11-10 1904/week @ 2024-11-17 1351/week @ 2024-11-24 1272/week @ 2024-12-01 1578/week @ 2024-12-08 2496/week @ 2024-12-15 438/week @ 2024-12-22 1450/week @ 2024-12-29 2419/week @ 2025-01-05

6,818 downloads per month
Used in 4 crates (via unicycle)

MIT/Apache

54KB
883 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