Trait sized_chunks::types::Bits
source · [−]pub trait Bits: Unsigned {
type Store: Default + Copy + PartialEq + Debug;
fn get(bits: &Self::Store, index: usize) -> bool;
fn set(bits: &mut Self::Store, index: usize, value: bool) -> bool;
fn len(bits: &Self::Store) -> usize;
fn first_index(bits: &Self::Store) -> Option<usize>;
}
Expand description
A type level number signifying the number of bits in a bitmap.
This trait is implemented for type level numbers from U1
to U128
.
Examples
assert_eq!(
std::mem::size_of::<<U10 as Bits>::Store>(),
std::mem::size_of::<u16>()
);