Crate aglet

Source
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 a HashMap<Coord, T> but faster

Also supports serde, under the default feature serde.

Structs§

Area
AreaIter
BitFlags
Represents a set of flags of some type T. T must have the #[bitflags] attribute applied.
Coord
Unsigned-int coordinates
CoordVec
Signed-int coordinates
Edges
EdgesIter
Grid
Like a HashMap<Coord, T> but faster. Each grid point might store something.
GridIntoIter
Owning iterator over the filled slots in a Grid.
GridIter
Borrowing iterator over the filled slots in a Grid.
GridIterMut
Mutably borrowing iterator over the filled slots in a Grid.
LineIter
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.
LineEndMode
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 for BitFlags<T>.

Type Aliases§

Direction4Set
Direction8Set