pub struct BitMask {
pub bits: Vec<u32>,
pub len: usize,
pub count: usize,
}Fields§
§bits: Vec<u32>§len: usize§count: usizeImplementations§
Source§impl BitMask
impl BitMask
pub fn full(len: usize) -> BitMask
Sourcepub fn set(&mut self, index: usize)
pub fn set(&mut self, index: usize)
Sets the bit at the given index to 1.
No-ops silently if the bit is already set so count stays accurate.
Sourcepub fn unset(&mut self, index: usize)
pub fn unset(&mut self, index: usize)
Clears the bit at the given index to 0.
No-ops silently if the bit is already clear so count stays accurate.
pub const fn is_empty(&self) -> bool
pub const fn is_full(&self) -> bool
Sourcepub fn and(&mut self, other: &BitMask)
pub fn and(&mut self, other: &BitMask)
Performs a bitwise AND in-place (intersection). Recounts set bits via popcount after the operation.
Sourcepub fn or(&mut self, other: &BitMask)
pub fn or(&mut self, other: &BitMask)
Performs a bitwise OR in-place (union). Recounts set bits via popcount after the operation.
Sourcepub fn iter(&self) -> BitMaskIter<'_> ⓘ
pub fn iter(&self) -> BitMaskIter<'_> ⓘ
Returns a high-performance iterator over the indices of set bits.
pub fn concat(self, b: BitMask) -> BitMask
pub fn extend(&mut self, b: BitMask)
Source§impl BitMask
impl BitMask
pub fn iter_zeros(&self) -> BitMaskZerosIter<'_> ⓘ
Trait Implementations§
Source§impl<'a> IntoIterator for &'a BitMask
impl<'a> IntoIterator for &'a BitMask
Auto Trait Implementations§
impl Freeze for BitMask
impl RefUnwindSafe for BitMask
impl Send for BitMask
impl Sync for BitMask
impl Unpin for BitMask
impl UnsafeUnpin for BitMask
impl UnwindSafe for BitMask
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