bitcram 0.1.0

A small, derive-based bit packing library for compact integer representations
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::{Buffer, Packable};

impl<B: Buffer> Packable<B> for bool {
    const SIZE: u32 = 1;

    #[inline]
    fn pack(&self) -> B {
        if *self { B::ONE } else { B::ZERO }
    }

    #[inline]
    fn unpack(buffer: B) -> Self {
        buffer == B::ONE
    }
}