smolmask

Crates.iosmolmask
lib.rssmolmask
version0.1.1
sourcesrc
created_at2023-07-17 14:19:00.29607
updated_at2023-07-17 14:20:39.578341
descriptionA small library for storing small binary masks in just a single integer.
homepage
repository
max_upload_size
id918538
size8,467
drbh (drbh)

documentation

README

smolmask

Crates.io MIT licensed

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]
}
Commit count: 0

cargo fmt