2 releases
0.1.1 | Jul 17, 2023 |
---|---|
0.1.0 | Jul 17, 2023 |
#2576 in Algorithms
5KB
71 lines
smolmask
Boolean arrays compressed into integers. Useful for storing boolean arrays in databases with just a single integer.
use smolmask::BoolArray;
fn main() {
let bools = vec![true, false, true, true];
let integer: u64 = BoolArray::store(&bools).unwrap();
println!("Integer: {}", integer); // 1096635
println!("Length: {}", BoolArray::length(integer)); // 4
println!("{:?}", BoolArray::retrieve(integer)); // [true, false, true, true]
}
Dependencies
~465KB