Skip to main content

Module bitvec

Module bitvec 

Source
Expand description

Stores booleans as individual bits - 8x smaller than Vec<bool>.

Use this when you’re tracking lots of boolean flags (like null bitmaps or set membership). Phase 3b: storage split into an immutable BitVector (refcounted Bytes) and a mutable BitVectorBuilder that produces one via freeze. This is the Apache Arrow / Lance “Array + Builder” idiom; the immutable side supports zero-copy mmap-backing for Phase 3c, while the builder retains the cheap word-level mutations needed by succinct-index construction (rank/select, wavelet trees, Elias-Fano).

§Example

let bools = vec![true, false, true, true, false, false, true, false];
let bitvec = BitVector::from_bools(&bools);
// Stored as: 0b01001101 (1 byte instead of 8)

assert_eq!(bitvec.get(0), Some(true));
assert_eq!(bitvec.get(1), Some(false));
assert_eq!(bitvec.count_ones(), 4);

Structs§

BitVector
Immutable bitset stored in a refcounted Bytes buffer of LE u64 words.
BitVectorBuilder
Mutable bit-vector builder. Word-level mutations stay cheap (Vec<u64> indexed access); call freeze to produce an immutable BitVector.

Enums§

BitVectorFormatError
Phase 6a: format-validation error returned by BitVector::from_mmap.