Crates.io | ittybitty |
lib.rs | ittybitty |
version | 0.2.0 |
source | src |
created_at | 2024-08-03 21:16:47.792944 |
updated_at | 2024-08-04 08:09:08.233696 |
description | An itty bitty bitset to hold your itty bitty bits. |
homepage | |
repository | https://github.com/atlv24/ittybitty |
max_upload_size | |
id | 1324546 |
size | 22,591 |
IttyBitty<N>
is a dynamically sized bit set that behaves akin to a SmallVec<[usize; N]>
It holds N * size_of::<usize>() - 1
bits inline. If a bit is set beyond that range, it will
allocate a buffer on the heap and stop using the inline bits. N
must be 2 or greater.
Please consult the documentation for more information.
Add it to your Cargo.toml:
[dependencies]
ittybitty = "0.1"
use ittybitty::IttyBitty;
let mut v = IttyBitty::<2>::new();
v.set(4, true);
assert_eq!(v.get(0), false);
assert_eq!(v.get(4), true);
This code is only mildly not garbage, good luck.
ittybitty
is dual-licensed under either:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.