pub struct BitMatrix(/* private fields */);
Expand description

A bitset with fixed-size rows.

Note that only the total size is tracked in BitMatrix and you must provide the width value when calling methods on BitMatrix.

Implementations§

source§

impl BitMatrix

source

pub fn height(&self, width: usize) -> usize

The height this matrix would have if it had given width.

Note that this might be greater than the height given to Self::new_with_size due to BitMatrix discarding information about actual size.

Panics

If Self is not empty and width equals 0 (division by zero)

source

pub fn active_rows_in_column(&self, width: usize, x: usize) -> Column<'_>

Iterate over active bits in given column.

Panics

When width = 0 (this would otherwise mean there is an infinite amount of columns)

source

pub fn row(&self, width: usize, y: usize) -> impl Iterator<Item = usize> + '_

Iterate over the enabled bits of a single row at y of this Bitmatrix.

Assuming the Bitmatrix has the provided width.

source

pub fn enable_bit(&mut self, width: usize, x: usize, y: usize) -> Option<()>

Enables bit at position bit.

Returns None and does nothing if bit is out of range.

When [Bitset::bit(bit)] will be called next, it will be true if this returned Some.

source

pub fn new_with_size(width: usize, height: usize) -> Self

Create a BitMatrix with given proportions.

Note that the total size is the lowest multiple of 32 higher or equal to width * height.

source

pub fn bit(&self, width: usize, x: usize, y: usize) -> bool

true if bit at position x, y in matrix is enabled.

false otherwise, included if x, y is outside of the matrix.

source

pub const fn sextant_display( &self, width: usize, height: usize ) -> SextantDisplay<'_>

Return a struct that, when printed with fmt::Display or fmt::Debug, displays the matrix using unicode sextant characters(pdf).

Trait Implementations§

source§

impl Clone for BitMatrix

source§

fn clone(&self) -> BitMatrix

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 Debug for BitMatrix

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.