#packing #no-alloc

no-std packed_booleans

A crate to pack booleans together

3 unstable releases

0.3.0 Nov 23, 2023
0.2.1 Aug 25, 2023
0.1.3 Aug 20, 2023

#189 in No standard library

MIT license

16KB
350 lines

A crate for packing booleans

crates.io

The standard bool type is always a full byte. This becomes a problem when multiple booleans are in the same struct, as 2 bools are stored as 2 bytes, which is unnecessary and wastes space.

This crate exists to solve that problem. The PackedBools type contains 8 booleans at the cost of only a single byte of memory.

no_std

This crate is fully no_std compatible.


lib.rs:

A crate for packing booleans together.

Dependencies

~180KB