pub struct BitMap<const N: usize = DEFAULT_CHUNK_SIZE> { /* private fields */ }Expand description
A bitmap that stores data in chunks of N bytes.
§Panics
Operations panic if bit / CHUNK_SIZE_BITS > usize::MAX. On 32-bit systems
with N=32, this occurs at bit >= 1,099,511,627,776.
Implementations§
Source§impl<const N: usize> BitMap<N>
impl<const N: usize> BitMap<N>
Sourcepub const CHUNK_SIZE_BITS: u64
pub const CHUNK_SIZE_BITS: u64
The size of a chunk in bits.
pub fn with_capacity(size: u64) -> Self
Sourcepub fn is_chunk_aligned(&self) -> bool
pub fn is_chunk_aligned(&self) -> bool
Returns true if the bitmap length is aligned to a chunk boundary.
Sourcepub fn push_chunk(&mut self, chunk: &[u8; N])
pub fn push_chunk(&mut self, chunk: &[u8; N])
Sourcepub fn count_ones(&self) -> u64
pub fn count_ones(&self) -> u64
Returns the number of bits set to 1.
Sourcepub fn count_zeros(&self) -> u64
pub fn count_zeros(&self) -> u64
Returns the number of bits set to 0.
Trait Implementations§
Source§impl<const N: usize> EncodeSize for BitMap<N>
impl<const N: usize> EncodeSize for BitMap<N>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§impl<const N: usize> Read for BitMap<N>
impl<const N: usize> Read for BitMap<N>
impl<const N: usize> Eq for BitMap<N>
impl<const N: usize> StructuralPartialEq for BitMap<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for BitMap<N>
impl<const N: usize> RefUnwindSafe for BitMap<N>
impl<const N: usize> Send for BitMap<N>
impl<const N: usize> Sync for BitMap<N>
impl<const N: usize> Unpin for BitMap<N>
impl<const N: usize> UnwindSafe for BitMap<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more