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
Sourcepub unsafe fn set_unchecked(&mut self, bit: usize, val: bool)
pub unsafe fn set_unchecked(&mut self, bit: usize, val: bool)
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 at or after bit.
Sourcepub fn prev_set_bit(&self, bit: usize) -> usize
pub fn prev_set_bit(&self, bit: usize) -> usize
Gets the first true bit before 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