Expand description
The gridly prelude includes all traits and common structs.
Note that the prelude does not include the single-character shorthand functions, so as not to pollute your namespace with single-character identifiers on a bulk import.
Re-exports
pub use crate::direction::Down;
pub use crate::direction::Left;
pub use crate::direction::Right;
pub use crate::direction::Up;
pub use crate::rotation::Anticlockwise;
pub use crate::rotation::Clockwise;
Structs
- A columns component of a
Vector
- A rows component of a
Vector
- A measurement of distance between two
Location
s
Enums
- An out-of-bounds error for a Location on a grid
Statics
- This array contains unit vectors associated with the 4 diagonal directions. It is intended to allow for easy iteration over diagonally adjacent locations. The order of the vectors is unspecified and should not be relied upon.
- This array contains each direction; it is intended to allow for easy iteration over adjacent locations. The order of the directions is left unspecified and should not be relied upon.
- This array contains unit vectors associated with the 4 orthogonally adjacent directions. It is intended to allow for easy iteration over orthogonally adjacent locations. The order of the vectors is unspecified and should not be relied upon.
- This array contains unit vectors associated with the 8 adjacent directions. It is intended to allow for easy iteration over all locations that touch a center location (for instance, when scanning adjacencies in an implementation of Conway’s Game of Life). The order of the vectors is unspecified and should not be relied upon.
Traits
- Base Reader trait for grids. This trait provides the grid’s cell type,
Item
, and an unsafe getter method for fetching a cell at a bounds-checked location. It uses this unsafe getter, plusGridBounds
based bounds-checking, to provide a comprehensive and safe interface for reading and iterating over elements in a grid. - Grid trait implementing grid sizes and boundary checking.
VectorLike
is implemented for types that can be used as a vector. They can participate in vector arithmetic, comparison, and other vector oprations.