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

  • memory on this container is sharable across thread boundaries
  • Cloning Bitmap is O(1)
  • Slicing Bitmap is O(1)

Implementations

Initializes an empty Bitmap.

Initializes an new Bitmap filled with unset values.

Returns the length of the Bitmap.

Returns whether Bitmap is empty

Creates a new Bitmap from Vec and a length. This function is O(1)

Panic

Panics iff length <= buffer.len() * 8

Creates a new Bitmap from a slice and length.

Panic

Panics iff length <= bytes.len() * 8

Counts the nulls (unset bits) starting from offset bits and for length bits.

Returns the number of unset bits on this Bitmap.

Slices self, offsetting 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()

Returns whether the bit at position i is set.

Panics

Panics iff i >= self.len().

Returns whether the bit at position i is set.

Unsafely returns whether the bit at position i is set.

Safety

Unsound iff i >= self.len().

Converts this Bitmap to MutableBitmap, returning itself if the conversion is not possible

This operation returns a MutableBitmap iff:

  • this Bitmap is not an offsetted slice of another Bitmap
  • this Bitmap has not been cloned (i.e. Arc::get_mut yields Some)
  • this Bitmap was not imported from the c data interface (FFI)

Returns an iterator over bits in chunks of T, which is useful for bit operations.

Creates a new Bitmap from an iterator of booleans.

Safety

The iterator must report an accurate length.

Creates a new Bitmap from an iterator of booleans.

Creates a new Bitmap from a fallible iterator of booleans.

Creates a new Bitmap from a fallible iterator of booleans.

Safety

The iterator must report an accurate length.

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.

constructs a new iterator

Trait Implementations

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.