15 releases
Uses new Rust 2024
| new 0.3.9 | Nov 3, 2025 |
|---|---|
| 0.3.8 | Aug 20, 2025 |
| 0.3.5 | Apr 22, 2025 |
| 0.3.4 | Feb 27, 2025 |
| 0.1.0 | Jul 2, 2024 |
#723 in Data structures
55KB
1.5K
SLoC
Say, we have a bit vector ---
it's nothing better than a Vec<bool>, but ...
what if we implement it,
and save some poor bits of memory?
Quick Start
use bitvek::bitvec;
let vec = bitvec![
true, true, true, true, false, false, false, false,
false, false, false, false, true, true, true, true,
];
Find it cumbersome? Try this:
#
// The total number of bits must be a multiple of 8.
let vec = bitvec![0b11110000, 0b00001111];
Memory Efficiency
To achieve memory savings, the total number of bits stored must exceed twice the machine word size in bytes, corresponding to 8 for 32-bit systems and 16 for 64-bit systems.
bitvek
Say, we have a bit vector —
it's nothing better than a Vec<bool>, but …
what if we implement it,
and save some poor bits of memory?
Quick Start
use bitvek::bitvec;
let vec = bitvec![
true, true, true, true, false, false, false, false,
false, false, false, false, true, true, true, true,
];
Find it cumbersome? Try this:
// The total number of bits must be a multiple of 8.
let vec = bitvec![0b11110000, 0b00001111];
Memory Efficiency
To achieve memory savings, the total number of bits stored must exceed twice the machine word size in bytes, corresponding to 8 for 32-bit systems and 16 for 64-bit systems.
Dependencies
~165–470KB