Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
API docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Jul 2, 2021
1 parent a539240 commit a2bfc99
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bitmap/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use super::Bitmap;
/// to [`Vec<bool>`], but each value is stored as a single bit, thereby achieving a compression of 8x.
/// This container is the counterpart of [`MutableBuffer`] 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 [`MutableBuffer<u8>`].
#[derive(Debug)]
Expand Down Expand Up @@ -148,11 +149,16 @@ impl MutableBitmap {
}

impl MutableBitmap {
/// Initializes a [`MutableBitmap`] from a [`MutableBuffer<u8>`] and a length.
/// # Panic
/// Panics iff the length is larger than the length of the buffer times 8.
#[inline]
pub fn from_buffer(buffer: MutableBuffer<u8>, length: usize) -> Self {
assert!(length <= buffer.len() * 8);
Self { buffer, length }
}

/// Returns an iterator over the values of the [`MutableBitmap`].
fn iter(&self) -> BitmapIter {
BitmapIter::new(&self.buffer, 0, self.len())
}
Expand Down

0 comments on commit a2bfc99

Please sign in to comment.