pub struct EnumBitMatrix<R: EnumSetType>(/* private fields */);
Expand description

A bitset similar to BitMatrix, but with a fixed column and row count, indexed by R EnumSetType.

Implementations§

source§

impl<R: EnumSetType> EnumBitMatrix<R>

source

pub fn new(width: u32) -> Self

Create a new EnumBitMatrix.

Panics

When width * #Variant(T) > u32::MAX.

source

pub fn set_row(&mut self, row: R, iter: impl Iterator<Item = u32>)

Enable bits from iter for given row.

Note that items of iter not within bit_width are ignored, and already enabled bits stay enabled.

source

pub const fn bit_width(&self) -> u32

The width in bits of individual rows of this EnumBitMatrix.

source

pub fn row( &self, row: R, range: Range<u32> ) -> impl SortedIterator<Item = u32> + '_

Iterate over enabled bits in row, limited to provided range.

If the range doesn’t fit within 0..bit_width, it will be truncated to fit within that range.

source

pub const fn rows(&self, rows: EnumSet<R>, range: Range<u32>) -> Rows<'_, R>

Iterate over enabled bits in all rows, limited to provided range.

Rows is a sorted iterator.

Trait Implementations§

source§

impl<R: Clone + EnumSetType> Clone for EnumBitMatrix<R>

source§

fn clone(&self) -> EnumBitMatrix<R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<R: EnumSetType> Debug for EnumBitMatrix<R>

source§

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

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

impl<R: PartialEq + EnumSetType> PartialEq for EnumBitMatrix<R>

source§

fn eq(&self, other: &EnumBitMatrix<R>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<R: Eq + EnumSetType> Eq for EnumBitMatrix<R>

source§

impl<R: EnumSetType> StructuralEq for EnumBitMatrix<R>

source§

impl<R: EnumSetType> StructuralPartialEq for EnumBitMatrix<R>

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for EnumBitMatrix<R>where R: RefUnwindSafe,

§

impl<R> Send for EnumBitMatrix<R>where R: Send,

§

impl<R> Sync for EnumBitMatrix<R>where R: Sync,

§

impl<R> Unpin for EnumBitMatrix<R>where R: Unpin,

§

impl<R> UnwindSafe for EnumBitMatrix<R>where R: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

§

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 Twhere U: TryFrom<T>,

§

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.