Struct arrow2::bitmap::MutableBitmap
source · [−]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
Initializes an empty MutableBitmap
.
Empties the MutableBitmap
.
Initializes a zeroed MutableBitmap
.
Initializes an a pre-allocated MutableBitmap
with capacity for capacity
bits.
Initializes an a pre-allocated MutableBitmap
with capacity for capacity
bits.
Pushes a new bit to the MutableBitmap
, re-sizing it if necessary.
Returns the capacity of MutableBitmap
in number of bits.
Pushes a new bit to the MutableBitmap
Safety
The caller must ensure that the MutableBitmap
has sufficient capacity.
Returns the number of unset bits on this MutableBitmap
.
Returns the length of the MutableBitmap
.
Returns whether MutableBitmap
is empty.
Extends MutableBitmap
by additional
values of constant value
.
Shrinks the capacity of the MutableBitmap
to fit its current length.
Extends self
from a TrustedLen
iterator.
pub unsafe fn extend_from_trusted_len_iter_unchecked<I: Iterator<Item = bool>>(
&mut self,
iterator: I
)
pub unsafe fn extend_from_trusted_len_iter_unchecked<I: Iterator<Item = bool>>(
&mut self,
iterator: I
)
Extends self
from an iterator of trusted len.
Safety
The caller must guarantee that the iterator has a trusted len.
pub unsafe fn from_trusted_len_iter_unchecked<I>(iterator: I) -> Self where
I: Iterator<Item = bool>,
pub unsafe fn from_trusted_len_iter_unchecked<I>(iterator: I) -> Self where
I: Iterator<Item = bool>,
Creates a new MutableBitmap
from an iterator of booleans.
Safety
The iterator must report an accurate length.
Creates a new MutableBitmap
from an iterator of booleans.
pub fn try_from_trusted_len_iter<E, I>(iterator: I) -> Result<Self, E> where
I: TrustedLen<Item = Result<bool, E>>,
pub fn try_from_trusted_len_iter<E, I>(iterator: I) -> Result<Self, E> where
I: TrustedLen<Item = Result<bool, E>>,
Creates a new MutableBitmap
from an iterator of booleans.
Creates a new MutableBitmap
from an falible iterator of booleans.
Safety
The caller must guarantee that the iterator is TrustedLen
.
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.
Extends the MutableBitmap
from a Bitmap
.
pub 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;
impl<'a> Iterator for BitmapIter<'a> type Item = bool;
constructs a new iterator over the values of MutableBitmap
.