pub struct MutableBitmap { /* private fields */ }Expand description
A container to store booleans. MutableBitmap is semantically equivalent
to Vec<bool>, but each value is stored as a single bit, thereby achieving a compression of 8x.
This container is the counterpart of Vec for boolean values.
MutableBitmap can be converted to a Bitmap at O(1).
The main difference against Vec<bool> is that a bitmap cannot be represented as &[bool].
Implementation
This container is backed by Vec<u8>.
Implementations
sourceimpl MutableBitmap
 
impl MutableBitmap
sourcepub fn new() -> MutableBitmap
 
pub fn new() -> MutableBitmap
Initializes an empty MutableBitmap.
sourcepub fn clear(&mut self)
 
pub fn clear(&mut self)
Empties the MutableBitmap.
sourcepub fn from_len_zeroed(length: usize) -> MutableBitmap
 
pub fn from_len_zeroed(length: usize) -> MutableBitmap
Initializes a zeroed MutableBitmap.
sourcepub fn with_capacity(capacity: usize) -> MutableBitmap
 
pub fn with_capacity(capacity: usize) -> MutableBitmap
Initializes a pre-allocated MutableBitmap with capacity for capacity bits.
sourcepub fn reserve(&mut self, additional: usize)
 
pub fn reserve(&mut self, additional: usize)
Reserves additional bits in the MutableBitmap, potentially re-allocating its buffer.
sourcepub fn push(&mut self, value: bool)
 
pub fn push(&mut self, value: bool)
Pushes a new bit to the MutableBitmap, re-sizing it if necessary.
sourcepub fn capacity(&self) -> usize
 
pub fn capacity(&self) -> usize
Returns the capacity of MutableBitmap in number of bits.
sourcepub unsafe fn push_unchecked(&mut self, value: bool)
 
pub unsafe fn push_unchecked(&mut self, value: bool)
Pushes a new bit to the MutableBitmap
Safety
The caller must ensure that the MutableBitmap has sufficient capacity.
sourcepub fn null_count(&self) -> usize
 
pub fn null_count(&self) -> usize
Returns the number of unset bits on this MutableBitmap.
sourcepub fn len(&self) -> usize
 
pub fn len(&self) -> usize
Returns the length of the MutableBitmap.
sourcepub fn is_empty(&self) -> bool
 
pub fn is_empty(&self) -> bool
Returns whether MutableBitmap is empty.
sourcepub fn extend_constant(&mut self, additional: usize, value: bool)
 
pub fn extend_constant(&mut self, additional: usize, value: bool)
Extends MutableBitmap by additional values of constant value.
sourcepub unsafe fn set_unchecked(&mut self, index: usize, value: bool)
 
pub unsafe fn set_unchecked(&mut self, index: usize, value: bool)
sourcepub fn shrink_to_fit(&mut self)
 
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableBitmap to fit its current length.
sourceimpl MutableBitmap
 
impl MutableBitmap
sourcepub fn from_vec(buffer: Vec<u8, Global>, length: usize) -> MutableBitmap
 
pub fn from_vec(buffer: Vec<u8, Global>, length: usize) -> MutableBitmap
Initializes a MutableBitmap from a Vec<u8> and a length.
This function is O(1).
Panic
Panics iff the length is larger than the length of the buffer times 8.
sourceimpl MutableBitmap
 
impl MutableBitmap
sourcepub fn extend_from_trusted_len_iter<I>(&mut self, iterator: I) where
    I: TrustedLen<Item = bool>, 
 
pub fn extend_from_trusted_len_iter<I>(&mut self, iterator: I) where
    I: TrustedLen<Item = bool>, 
Extends self from a TrustedLen iterator.
sourcepub unsafe fn extend_from_trusted_len_iter_unchecked<I>(&mut self, iterator: I) where
    I: Iterator<Item = bool>, 
 
pub unsafe fn extend_from_trusted_len_iter_unchecked<I>(&mut self, iterator: I) where
    I: Iterator<Item = bool>, 
Extends self from an iterator of trusted len.
Safety
The caller must guarantee that the iterator has a trusted len.
sourcepub unsafe fn from_trusted_len_iter_unchecked<I>(iterator: I) -> MutableBitmap where
    I: Iterator<Item = bool>, 
 
pub unsafe fn from_trusted_len_iter_unchecked<I>(iterator: I) -> MutableBitmap where
    I: Iterator<Item = bool>, 
Creates a new MutableBitmap from an iterator of booleans.
Safety
The iterator must report an accurate length.
sourcepub fn from_trusted_len_iter<I>(iterator: I) -> MutableBitmap where
    I: TrustedLen<Item = bool>, 
 
pub fn from_trusted_len_iter<I>(iterator: I) -> MutableBitmap where
    I: TrustedLen<Item = bool>, 
Creates a new MutableBitmap from an iterator of booleans.
sourcepub fn try_from_trusted_len_iter<E, I>(iterator: I) -> Result<MutableBitmap, E> where
    I: TrustedLen<Item = Result<bool, E>>, 
 
pub fn try_from_trusted_len_iter<E, I>(iterator: I) -> Result<MutableBitmap, E> where
    I: TrustedLen<Item = Result<bool, E>>, 
Creates a new MutableBitmap from an iterator of booleans.
sourcepub unsafe fn try_from_trusted_len_iter_unchecked<E, I>(
    iterator: I
) -> Result<MutableBitmap, E> where
    I: Iterator<Item = Result<bool, E>>, 
 
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I>(
    iterator: I
) -> Result<MutableBitmap, E> where
    I: Iterator<Item = Result<bool, E>>, 
Creates a new MutableBitmap from an falible iterator of booleans.
Safety
The caller must guarantee that the iterator is TrustedLen.
sourcepub fn extend_from_slice(&mut self, slice: &[u8], offset: usize, length: usize)
 
pub fn extend_from_slice(&mut self, slice: &[u8], offset: usize, length: usize)
Extends the MutableBitmap from a slice of bytes with optional offset.
This is the fastest way to extend a MutableBitmap.
Implementation
When both MutableBitmap’s length and offset are both multiples of 8,
this function performs a memcopy. Else, it extends MutableBitmap bit by bit.
sourcepub fn extend_from_bitmap(&mut self, bitmap: &Bitmap)
 
pub fn extend_from_bitmap(&mut self, bitmap: &Bitmap)
Extends the MutableBitmap from a Bitmap.
sourceimpl<'a> MutableBitmap
 
impl<'a> MutableBitmap
sourcepub fn iter(&'a self) -> BitmapIter<'a>ⓘNotable traits for BitmapIter<'a>impl<'a> Iterator for BitmapIter<'a>    type Item = bool;
 
pub fn iter(&'a self) -> BitmapIter<'a>ⓘNotable traits for BitmapIter<'a>impl<'a> Iterator for BitmapIter<'a>    type Item = bool;
constructs a new iterator over the values of MutableBitmap.
Trait Implementations
sourceimpl Debug for MutableBitmap
 
impl Debug for MutableBitmap
sourceimpl Default for MutableBitmap
 
impl Default for MutableBitmap
sourcefn default() -> MutableBitmap
 
fn default() -> MutableBitmap
Returns the “default value” for a type. Read more
sourceimpl From<MutableBitmap> for Bitmap
 
impl From<MutableBitmap> for Bitmap
sourcefn from(buffer: MutableBitmap) -> Bitmap
 
fn from(buffer: MutableBitmap) -> Bitmap
Performs the conversion.
sourceimpl<P> From<P> for MutableBitmap where
    P: AsRef<[bool]>, 
 
impl<P> From<P> for MutableBitmap where
    P: AsRef<[bool]>, 
sourcefn from(slice: P) -> MutableBitmap
 
fn from(slice: P) -> MutableBitmap
Performs the conversion.
sourceimpl FromIterator<bool> for MutableBitmap
 
impl FromIterator<bool> for MutableBitmap
sourcefn from_iter<I>(iter: I) -> MutableBitmap where
    I: IntoIterator<Item = bool>, 
 
fn from_iter<I>(iter: I) -> MutableBitmap where
    I: IntoIterator<Item = bool>, 
Creates a value from an iterator. Read more
sourceimpl<'a> IntoIterator for &'a MutableBitmap
 
impl<'a> IntoIterator for &'a MutableBitmap
type IntoIter = BitmapIter<'a>
type IntoIter = BitmapIter<'a>
Which kind of iterator are we turning this into?
sourcefn into_iter(self) -> <&'a MutableBitmap as IntoIterator>::IntoIter
 
fn into_iter(self) -> <&'a MutableBitmap as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl PartialEq<MutableBitmap> for MutableBitmap
 
impl PartialEq<MutableBitmap> for MutableBitmap
Auto Trait Implementations
impl RefUnwindSafe for MutableBitmap
impl Send for MutableBitmap
impl Sync for MutableBitmap
impl Unpin for MutableBitmap
impl UnwindSafe for MutableBitmap
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