liblisa::utils::bitmap

Trait BitmapSlice

pub trait BitmapSlice {
Show 17 methods // Required methods fn get(&self, index: usize) -> bool; fn len(&self) -> usize; fn iter_data(&self) -> impl Iterator<Item = u64> + '_; // Provided methods fn is_empty(&self) -> bool { ... } fn count_overlapping_with(&self, other: &impl BitmapSlice) -> usize where Self: Sized { ... } fn overlaps_with(&self, other: &impl BitmapSlice) -> bool where Self: Sized { ... } fn is_all_zeros(&self) -> bool { ... } fn is_subset_of(&self, other: &impl BitmapSlice) -> bool { ... } fn flipped(&self) -> Flipped<'_, Self> where Self: Sized { ... } fn anded_with<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> AndWith<'r, Self, B> where Self: Sized { ... } fn xored_with<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> XorWith<'r, Self, B> where Self: Sized { ... } fn ored_with<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> OrWith<'r, Self, B> where Self: Sized { ... } fn cleared_from<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> ClearFrom<'r, Self, B> where Self: Sized { ... } fn iter_one_indices(&self) -> impl Iterator<Item = usize> + '_ { ... } fn iter(&self) -> impl Iterator<Item = bool> + '_ { ... } fn count_ones(&self) -> usize { ... } fn count_zeros(&self) -> usize { ... }
}
Expand description

A read-only bitmap slice.

Required Methods§

fn get(&self, index: usize) -> bool

Returns the value of the bit at position index.

fn len(&self) -> usize

Returns the number of bits in the bitmap.

fn iter_data(&self) -> impl Iterator<Item = u64> + '_

Iterates over the internal backing data of the bitmap.

Provided Methods§

fn is_empty(&self) -> bool

Return true if the bitmap is empty.

fn count_overlapping_with(&self, other: &impl BitmapSlice) -> usize
where Self: Sized,

Counts the number of bits that are one in both this bitmap and other.

fn overlaps_with(&self, other: &impl BitmapSlice) -> bool
where Self: Sized,

Returns true if the bitmap overlaps with other. In other words, if there is any bit which is set in both bitmaps.

fn is_all_zeros(&self) -> bool

Returns true if all bits in the bitmap are set to one.

fn is_subset_of(&self, other: &impl BitmapSlice) -> bool

Returns true if, for all bits set in the bitmap, it is also set in other.

fn flipped(&self) -> Flipped<'_, Self>
where Self: Sized,

Returns a slice to a bitmap where each bit is negated.

fn anded_with<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> AndWith<'r, Self, B>
where Self: Sized,

Returns a slice to a bitmap where each bit is ANDed with other.

fn xored_with<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> XorWith<'r, Self, B>
where Self: Sized,

Returns a slice to a bitmap where each bit is XORed with other.

fn ored_with<'r, B: BitmapSlice>(&'r self, other: &'r B) -> OrWith<'r, Self, B>
where Self: Sized,

Returns a slice to a bitmap where each bit is ORed with other.

fn cleared_from<'r, B: BitmapSlice>( &'r self, other: &'r B, ) -> ClearFrom<'r, Self, B>
where Self: Sized,

Returns a slice to a bitmap where each bit is set to self & !other.

fn iter_one_indices(&self) -> impl Iterator<Item = usize> + '_

Iterates over all indices in the bitmap that are set to one.

fn iter(&self) -> impl Iterator<Item = bool> + '_

Iterates over all bits in the bitmap.

fn count_ones(&self) -> usize

Counts the number of bits that are one.

fn count_zeros(&self) -> usize

Counts the number of bits that are zero.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§