pub struct BitMatrix {
    pub width: usize,
    pub height: usize,
    /* private fields */
}
Expand description

A 2-d bit-matrix.

Fields

width: usize

Width of the matrix.

height: usize

Height of the matrix.

Implementations

Creates an empty BitMatrix with zero width or height.

Creates an empty BitMatrix with predefined dimensions.

Builds a BitMatrix instance from another collection of bits.

If the data passed in contains more bits than will fit a matrix of the specified height and width, excess data is discarded. If not enough bits are passed in, 0s will be appended until the right size is reached.

Returns the state of a bit at a specific coordinate.

Returns the state of all the bits at a specific x-coordinate.

Bits are ordered by row, starting at y-coordinate 0.

Returns the state of all the bits at a specific y-coordinate.

Bits are ordered by column, starting at x-coordinate 0.

Changes the state of a bit at a specififc coordinate.

Changes the width of the matrix.

If len is greater than matrix’s width, each row is extended with 0s. Otherwise, each row is concatenated.

Changes the hieght of the matrix.

If len is greater than matrix’s height, it is extended with blank rows. Otherwise, the number of rows is suitably concatenated.

Produces the contents of the matrix as a flat vec of bits.

Vec contains each row one after another.

Consumes the BitMatrix to produce its contents as a flat vec of bits.

Vec contains each row one after another.

Produces the contents of the matrix as a vec of its columns.

Consumes the BitMatrix to produce its contents as a vec of its columns.

Produces the contents of the matrix as a vec of its rows.

Consumes the BitMatrix to produce its contents as a vec of its rows.

Reduces the width and height such that there are no empty columns or rows on the edges.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.