pub struct Coord {
pub x: u8,
pub y: u8,
}
A coordinate on a Hex board, such that (x, y) = (0, 0) is the top left and (1, 0) is the hex
immediately to the right of that hex. Cannot support boards larger than 128x128 for performance
reasons.
The x-axis, starting from the left column at 0.
The y-axis, starting from the top row at 0.
Creates a new Coord
, returning None
if either x or y exceed 25.
Returns an iterator representing each of this hex's neighbors, clockwise from the top left. If
this hex is on the first row or column, will return fewer than six coordinates.
Returns true if the two hexes neighbor each other or equal each other, and false otherwise.
Gets the absolute difference between two unsigned u8s, in a way that avoids overflow.
Gets the distance between two coordinates, defined as the number of steps in the grid needed
to connect them. A distance of 0 means equality, and a distance of 1 means the two are
neighboring.
Returns the "default value" for a type. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
The resulting type after applying the +
operator.
Adds componentwise, but does not check the addition.
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Compare self to key
and return true
if they are equal.