Struct sized_chunks::Bitmap
source · [−]pub struct Bitmap<Size: Bits> { /* private fields */ }
Expand description
A compact array of bits.
The bitmap is stored as a primitive type, so the maximum value of Size
is
currently 128, corresponding to a type of u128
. The type used to store the
bitmap will be the minimum unsigned integer type required to fit the number
of bits required, from u8
to u128
.
Examples
let mut bitmap = Bitmap::<U10>::new();
assert_eq!(bitmap.set(5, true), false);
assert_eq!(bitmap.set(5, true), true);
assert_eq!(bitmap.get(5), true);
assert_eq!(bitmap.get(6), false);
assert_eq!(bitmap.len(), 1);
assert_eq!(bitmap.set(3, true), false);
assert_eq!(bitmap.len(), 2);
assert_eq!(bitmap.first_index(), Some(3));
Implementations
sourceimpl<Size: Bits> Bitmap<Size>
impl<Size: Bits> Bitmap<Size>
Trait Implementations
sourceimpl<Size: Bits> IntoIterator for Bitmap<Size>
impl<Size: Bits> IntoIterator for 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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more