pub struct Bitmap { /* private fields */ }
Expand description
An immutable container whose API is optimized to handle bitmaps. All quantities on this container’s API are measured in bits.
Implementation
Implementations
Initializes an new Bitmap
filled with unset values.
Counts the nulls (unset bits) starting from offset
bits and for length
bits.
Returns the number of unset bits on this Bitmap
.
Slices self
, offseting by offset
and truncating up to length
bits.
Panic
Panics iff self.offset + offset + length >= self.bytes.len() * 8
, i.e. if the offset and length
exceeds the allocated capacity of self
.
Slices self
, offseting by offset
and truncating up to length
bits.
Safety
The caller must ensure that self.offset + offset + length <= self.len()
Creates a new Bitmap
from an iterator of booleans.
pub fn try_from_trusted_len_iter<E, I: TrustedLen<Item = Result<bool, E>>>(
iterator: I
) -> Result<Self, E>
pub fn try_from_trusted_len_iter<E, I: TrustedLen<Item = Result<bool, E>>>(
iterator: I
) -> Result<Self, E>
Creates a new Bitmap
from a fallible iterator of booleans.
Returns the byte slice of this Bitmap.
The returned tuple contains:
.1 -> The byte slice, truncated to the start of the first bit. So the start of the slice
is within the first 8 bits.
.2 -> The start offset in bits, given what described above 0 <= offsets < 8
.
.3 -> The length in bits.
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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Bitmap
impl UnwindSafe for Bitmap
Blanket Implementations
Mutably borrows from an owned value. Read more