Skip to main content

RleBitmapBase

Struct RleBitmapBase 

Source
pub struct RleBitmapBase<T> { /* private fields */ }
Expand description

A run-length encoded bitmap.

Implementations§

Source§

impl<T> RleBitmapBase<T>

Source

pub fn project<'__pin>( self: Pin<&'__pin mut Self>, ) -> RleBitmapBaseProjection<'__pin, T>

Pin-projects all fields of Self.

These fields are structurally pinned:

  • elems

These fields are not structurally pinned:

  • num_elems
  • num_bits
Source§

impl<T> RleBitmapBase<T>

Source

pub fn iter(&self) -> Iterator<'_, ElementPtr<T>>

Returns an iterator over the elements of this bitmap.

Source§

impl<T> RleBitmapBase<T>
where T: Copy + Eq + Ord + Default + Add<Output = T> + Sub<Output = T> + From<u8>,

Source

pub fn new() -> impl PinInit<Self, Infallible>

Create a new, empty run-length encoded bitmap.

Since the underlying intrusive list must be pinned in memory, this returns an initializer that must be pinned (e.g. using pin_init::pin_init!).

Source

pub fn num_ranges(&self) -> usize

Returns the current number of ranges (runs of set bits) in the bitmap.

Source

pub fn num_bits(&self) -> T

Returns the current total number of set bits in the bitmap.

Source

pub fn set_no_alloc( &mut self, bitoff: T, bitmax: T, free_list: &mut FreeList<T>, ) -> Result<(), Status>

Sets all bits in the range [bitoff, bitmax).

Only fails if bitmax < bitoff or if an allocation is needed and free_list does not contain one.

free_list is a list of usable allocations. If an allocation is needed, it will be drawn from it. This function is guaranteed to need at most one allocation. If any nodes need to be deleted, they will be appended to free_list.

Source

pub fn clear_no_alloc( &mut self, bitoff: T, bitmax: T, free_list: &mut FreeList<T>, ) -> Result<(), Status>

Clears all bits in the range [bitoff, bitmax).

Only fails if bitmax < bitoff or if an allocation is needed and free_list does not contain one.

free_list is a list of usable allocations. If an allocation is needed, it will be drawn from it. This function is guaranteed to need at most one allocation. If any nodes need to be deleted, they will be appended to free_list.

Trait Implementations§

Source§

impl<T> Bitmap<T> for RleBitmapBase<T>
where T: Copy + Eq + Ord + Default + Add<Output = T> + Sub<Output = T> + From<u8>,

Source§

fn find( &self, is_set: bool, bitoff: T, bitmax: T, run_len: T, ) -> Result<T, Status>

Finds a run of run_len is_set bits, between bitoff and bitmax. Read more
Source§

fn get(&self, bitoff: T, bitmax: T) -> GetResult<T>

Returns true if all the bits in [bitoff, bitmax) are set. Read more
Source§

fn set(&mut self, bitoff: T, bitmax: T) -> Result<(), Status>

Sets all bits in the range [bitoff, bitmax). Read more
Source§

fn clear(&mut self, bitoff: T, bitmax: T) -> Result<(), Status>

Clears all bits in the range [bitoff, bitmax). Read more
Source§

fn clear_all(&mut self)

Clear all bits in the bitmap.
Source§

fn get_one(&self, bitoff: T) -> bool

Returns true if the bit at bitoff is set.
Source§

fn set_one(&mut self, bitoff: T) -> Result<(), Status>

Sets the bit at bitoff.
Source§

fn clear_one(&mut self, bitoff: T) -> Result<(), Status>

Clears the bit at bitoff.
Source§

impl<T: Debug> Debug for RleBitmapBase<T>

Source§

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

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

impl<T> HasPinData for RleBitmapBase<T>

Source§

type PinData = __ThePinData<T>

Source§

unsafe fn __pin_data() -> Self::PinData

Source§

impl<'a, T> IntoIterator for &'a RleBitmapBase<T>

Source§

type Item = &'a Element<T>

The type of the elements being iterated over.
Source§

type IntoIter = Iterator<'a, UniquePtr<Element<T>>>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RleBitmapBase<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for RleBitmapBase<T>

§

impl<T> !Send for RleBitmapBase<T>

§

impl<T> !Sync for RleBitmapBase<T>

§

impl<T> !UnsafeUnpin for RleBitmapBase<T>

§

impl<T> !UnwindSafe for RleBitmapBase<T>

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> Init<T> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
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> PinInit<T> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
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.