Expand description
§Another Grid Library Except Terrible
This is a successor to my old crate cogs_gamedev’s grids
module.
It adds opinionated integer-based coordinates and directions, along with some other useful things:
- Iterators over areas, edges of areas, and lines
Grid<T>
, which is like aHashMap<Coord, T>
but faster
Also supports serde, under the default feature serde
.
Structs§
- Area
- Area
Iter - BitFlags
- Represents a set of flags of some type
T
.T
must have the#[bitflags]
attribute applied. - Coord
- Unsigned-int coordinates
- Coord
Vec - Signed-int coordinates
- Edges
- Edges
Iter - Grid
- Like a
HashMap<Coord, T>
but faster. Each grid point might store something. - Grid
Into Iter - Owning iterator over the filled slots in a
Grid
. - Grid
Iter - Borrowing iterator over the filled slots in a
Grid
. - Grid
Iter Mut - Mutably borrowing iterator over the filled slots in a
Grid
. - Line
Iter - Iterates over coordinates on a line using Bresenham’s algorithm.
Enums§
- Direction4
- Four-way directions.
- Direction8
- Eight-way directions.
- Direction9
- Nine-way directions: 8 compass points plus center.
- Line
EndMode - Where to stop the iteration of the line.
- Rotation
- 2-way rotations: clockwise or counterclockwise. These don’t indicate any specific angle by themselves, only in relation to something.
Traits§
- BitFlag
- A trait automatically implemented by
#[bitflags]
to make the enum a valid type parameter forBitFlags<T>
.