Struct Bitmap

Source
pub struct Bitmap<S: Storage, E: Element> { /* private fields */ }
Expand description

A dense bitmap, intended to store small bitslices (<= width of u64).

That is, this type represents an array of values, where each value is E::width(instance) bits long, and the bits are stored contiguously. The first value is packed into the least significant bits of the first word.

Implementations§

Source§

impl<S: Storage, E: Element> Bitmap<S, E>

Source

pub fn from_storage(entries: usize, w: E::W, storage: S) -> Option<Bitmap<S, E>>

Source

pub fn get(&self, i: usize) -> Option<E::R>

Get the ith bitslice, returning None on out-of-bounds or if E::from_bits returns None.

Source

pub fn set(&mut self, i: usize, value: E::R) -> bool

Set the ith bitslice to value, returning false on out-of-bounds or if value contains bits outside of the least significant E::width(w) bits.

Source

pub fn len(&self) -> usize

Length in number of bitslices cointained.

Source

pub fn usize_len(&self) -> usize

Size of the internal buffer, in number of usizes.

Source

pub fn iter(&self) -> Slices<'_, S, E>

Source

pub fn unwrap(self) -> S

Source§

impl<S: Storage> Bitmap<S, OneBit>

Source

pub fn first_set(&self) -> Option<usize>

Return the index of the first bit set

Trait Implementations§

Source§

impl<S: Storage, E: Element> Debug for Bitmap<S, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, S: Storage, E: Element> IntoIterator for &'a Bitmap<S, E>

Source§

type Item = <E as Element>::R

The type of the elements being iterated over.
Source§

type IntoIter = Slices<'a, S, E>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Slices<'a, S, E>

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<S, E> Freeze for Bitmap<S, E>
where <E as Element>::W: Freeze, S: Freeze,

§

impl<S, E> RefUnwindSafe for Bitmap<S, E>

§

impl<S, E> Send for Bitmap<S, E>
where <E as Element>::W: Send, S: Send, E: Send,

§

impl<S, E> Sync for Bitmap<S, E>
where <E as Element>::W: Sync, S: Sync, E: Sync,

§

impl<S, E> Unpin for Bitmap<S, E>
where <E as Element>::W: Unpin, S: Unpin, E: Unpin,

§

impl<S, E> UnwindSafe for Bitmap<S, E>
where <E as Element>::W: UnwindSafe, S: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.