pub struct Bitmap<Size: Bits> { /* private fields */ }
Expand description
A compact array of bits.
The type used to store the bitmap will be the minimum unsigned integer type
required to fit the number of bits, from u8
to u128
. If the size is 1,
bool
is used. If the size exceeds 128, an array of u128
will be used,
sized as appropriately. The maximum supported size is currently 1024,
represented by an array [u128; 8]
.
Implementations
sourceimpl Bitmap<U128>
impl Bitmap<U128>
pub unsafe fn load_m128i(&self) -> __m128i
sse2
only.sourceimpl Bitmap<U256>
impl Bitmap<U256>
pub unsafe fn load_m128i(&self) -> [__m128i; 2]
sse2
only.pub unsafe fn load_m256i(&self) -> __m256i
avx
only.sourceimpl Bitmap<U512>
impl Bitmap<U512>
pub unsafe fn load_m128i(&self) -> [__m128i; 4]
sse2
only.pub unsafe fn load_m256i(&self) -> [__m256i; 2]
avx
only.sourceimpl Bitmap<U768>
impl Bitmap<U768>
pub unsafe fn load_m128i(&self) -> [__m128i; 6]
sse2
only.pub unsafe fn load_m256i(&self) -> [__m256i; 3]
avx
only.sourceimpl Bitmap<U1024>
impl Bitmap<U1024>
pub unsafe fn load_m128i(&self) -> [__m128i; 8]
sse2
only.pub unsafe fn load_m256i(&self) -> [__m256i; 4]
avx
only.sourceimpl<Size: Bits> Bitmap<Size>
impl<Size: Bits> Bitmap<Size>
sourcepub fn mask(bits: usize) -> Self
pub fn mask(bits: usize) -> Self
Construct a bitmap where every bit with index less than bits
is
true
, and every other bit is false
.
sourcepub fn from_value(data: Size::Store) -> Self
pub fn from_value(data: Size::Store) -> Self
Construct a bitmap from a value of the same type as its backing store.
sourcepub fn into_value(self) -> Size::Store
pub fn into_value(self) -> Size::Store
Convert this bitmap into a value of the type of its backing store.
sourcepub fn set(&mut self, index: usize, value: bool) -> bool
pub fn set(&mut self, index: usize, value: bool) -> bool
Set the value of the bit at a given index.
Returns the previous value of the bit.
sourcepub fn first_index(self) -> Option<usize>
pub fn first_index(self) -> Option<usize>
Find the index of the first true
bit in the bitmap.
Trait Implementations
sourceimpl<Size: Bits> BitAndAssign<Bitmap<Size>> for Bitmap<Size>
impl<Size: Bits> BitAndAssign<Bitmap<Size>> for Bitmap<Size>
sourcefn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the &=
operation. Read more
sourceimpl<Size: Bits> BitOrAssign<Bitmap<Size>> for Bitmap<Size>
impl<Size: Bits> BitOrAssign<Bitmap<Size>> for Bitmap<Size>
sourcefn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the |=
operation. Read more
sourceimpl<Size: Bits> BitXorAssign<Bitmap<Size>> for Bitmap<Size>
impl<Size: Bits> BitXorAssign<Bitmap<Size>> for Bitmap<Size>
sourcefn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the ^=
operation. Read more
sourceimpl<'a, Size: Bits> IntoIterator for &'a Bitmap<Size>
impl<'a, Size: Bits> IntoIterator for &'a Bitmap<Size>
impl<Size: Bits> Copy for Bitmap<Size>
Auto Trait Implementations
impl<Size> RefUnwindSafe for Bitmap<Size> where
<Size as Bits>::Store: RefUnwindSafe,
impl<Size> Send for Bitmap<Size> where
<Size as Bits>::Store: Send,
impl<Size> Sync for Bitmap<Size> where
<Size as Bits>::Store: Sync,
impl<Size> Unpin for Bitmap<Size> where
<Size as Bits>::Store: Unpin,
impl<Size> UnwindSafe for Bitmap<Size> where
<Size as Bits>::Store: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more