5 releases

new 0.2.3 Oct 26, 2024
0.2.2 Oct 16, 2024
0.2.1 Jul 12, 2024
0.2.0 Jul 5, 2024
0.1.0 Jul 2, 2024

#1142 in Data structures

Download history 144/week @ 2024-07-04 119/week @ 2024-07-11 2/week @ 2024-07-18 10/week @ 2024-09-19 15/week @ 2024-09-26 83/week @ 2024-10-10 65/week @ 2024-10-17

168 downloads per month

MIT license

26KB
572 lines

bitvek

Crates.io Documentation License: MIT

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

The following vector only takes two bytes of the heap memory!

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:

// requires the total number of bits to be a multiple of 8
let vec = bitvec![0b1111_0000, 0b0000_1111];

lib.rs:

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

The following vector only takes two bytes of the heap memory!

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:

#
// requires the total number of bits to be a multiple of 8
let vec = bitvec![0b1111_0000, 0b0000_1111];

No runtime deps