Struct sqrid::Gridbool

source ·
pub struct Gridbool<const WIDTH: u16, const HEIGHT: u16, const WORDS: usize>(_);
Expand description

Space-optimized grid of booleans using bitmaps

Gridbool uses an array of u32 to implement a Qa-indexable grid of booleans, balancing space and performance.

At the moment we need to provide the number of u32 WORDS to use due to rust generic const limitations. We are able to check that the value is appropriate, though.

We can use the gridbool_create macro to use a Qa as a source of these values.

Implementations§

Const Gridbool filled with true values.

Const Gridbool filled with false values.

Create a Gridbool filled with the provided value.

Set the provided Qa position to true.

Set the provided Qa position to false.

Set the provided Qa position to value.

Return the value at position Qa.

Consume self and returns the inner bitmap.

Return a reference to the inner bitmap; useful for testing.

Return a mut reference to the inner bitmap; useful for testing.

Iterate over all true/false values in the Gridbool.

Iterate over all coordinates and corresponding true/false values.

Iterate over all true coordinates the Gridbool.

Iterate over all false coordinates the Gridbool.

Take a Qa iterator and set all corresponding values to true.

Take a Qa iterator and set all corresponding values to false.

Flip all elements horizontally.

Flip all elements vertically.

Rotate all elements 90 degrees clockwise

Rotate all elements 90 degrees counterclockwise

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
Formats the value using the given formatter. Read more
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Check if the provided Qa is in the set
Insert the provided Qa
Remove the provided Qa
Insert or remove the provided Qa

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
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. 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.