pub struct BitMask<'a> { /* private fields */ }
Implementations§
Source§impl<'a> BitMask<'a>
impl<'a> BitMask<'a>
pub fn from_bitmap(bitmap: &'a Bitmap) -> Self
pub fn len(&self) -> usize
pub fn split_at(&self, idx: usize) -> (Self, Self)
Sourcepub unsafe fn split_at_unchecked(&self, idx: usize) -> (Self, Self)
pub unsafe fn split_at_unchecked(&self, idx: usize) -> (Self, Self)
§Safety
The index must be in-bounds.
pub fn get_u32(&self, idx: usize) -> u32
Sourcepub fn nth_set_bit_idx(&self, n: usize, start: usize) -> Option<usize>
pub fn nth_set_bit_idx(&self, n: usize, start: usize) -> Option<usize>
Computes the index of the nth set bit after start.
Both are zero-indexed, so nth_set_bit_idx(0, 0) finds the index of the first bit set (which can be 0 as well). The returned index is absolute, not relative to start.
Sourcepub fn nth_set_bit_idx_rev(&self, n: usize, end: usize) -> Option<usize>
pub fn nth_set_bit_idx_rev(&self, n: usize, end: usize) -> Option<usize>
Computes the index of the nth set bit before end, counting backwards.
Both are zero-indexed, so nth_set_bit_idx_rev(0, len) finds the index of the last bit set (which can be 0 as well). The returned index is absolute (and starts at the beginning), not relative to end.
pub fn get(&self, idx: usize) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for BitMask<'a>
impl<'a> RefUnwindSafe for BitMask<'a>
impl<'a> Send for BitMask<'a>
impl<'a> Sync for BitMask<'a>
impl<'a> Unpin for BitMask<'a>
impl<'a> UnwindSafe for BitMask<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more