pub struct IttyBitty<const N: usize> { /* private fields */ }Expand description
A memory-access optimized dynamically sized bitset.
IttyBitty<N> is backed by a [usize; N], but can spill to heap allocation.
Implementations§
source§impl<const N: usize> IttyBitty<N>
impl<const N: usize> IttyBitty<N>
sourcepub fn with_capacity(bits: usize) -> Self
pub fn with_capacity(bits: usize) -> Self
Create an empty inline IttyBitty with enough capacity to hold bits
sourcepub unsafe fn get_unchecked(&self, bit: usize) -> bool
pub unsafe fn get_unchecked(&self, bit: usize) -> bool
Get the bit at bit without bounds checks.
sourcepub unsafe fn set_unchecked(&mut self, bit: usize, val: bool)
pub unsafe fn set_unchecked(&mut self, bit: usize, val: bool)
Set the bit at bit without bounds checks.
sourcepub fn set(&mut self, bit: usize, value: bool)
pub fn set(&mut self, bit: usize, value: bool)
Set the bit at bit to value.
Extends capacity as needed if value is true, no-op if false and beyond bounds.
sourcepub fn next_set_bit(&self, bit: usize) -> usize
pub fn next_set_bit(&self, bit: usize) -> usize
Gets the first true bit after bit.
Trait Implementations§
source§impl<'a, const N: usize> IntoIterator for &'a IttyBitty<N>
impl<'a, const N: usize> IntoIterator for &'a IttyBitty<N>
source§impl<const N: usize> IntoIterator for IttyBitty<N>
impl<const N: usize> IntoIterator for IttyBitty<N>
impl<const N: usize> Eq for IttyBitty<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for IttyBitty<N>
impl<const N: usize> RefUnwindSafe for IttyBitty<N>
impl<const N: usize> Send for IttyBitty<N>
impl<const N: usize> Sync for IttyBitty<N>
impl<const N: usize> Unpin for IttyBitty<N>
impl<const N: usize> UnwindSafe for IttyBitty<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