Enum hex2d::Direction
[−]
[src]
pub enum Direction { YZ, XZ, XY, ZY, ZX, YX, }
Direction on a hexagonal map
See Coordinate
for graph with directions.
Naming convention: increasing coordinate for a given direction is first decreasing is second. The missing coordinate is unaffected by a move in a given direction.
Variants
YZ
+Y -Z
XZ
-Z +X
XY
+X -Y
ZY
-Y +Z
ZX
+Z -X
YX
-X +Y
Methods
impl Direction
[src]
fn all() -> &'static [Direction; 6]
[src]
Static array of all directions
use hex2d::Direction; assert_eq!(Direction::all().len(), 6);
fn arc(&self, steps: u8) -> Vec<Direction>
[src]
Return a vector of an arc including Directions steps
away from the original Direction both
sides from left to right.
use hex2d::{Direction}; use hex2d::Angle::*; for &d in Direction::all() { assert_eq!(d.arc(0), vec!(d)); assert_eq!(d.arc(1), vec!(d + Left, d, d + Right)); assert_eq!(d.arc(2), vec!(d + LeftBack, d + Left, d, d + Right, d + RightBack)); assert_eq!(d.arc(3), vec!(d + LeftBack, d + Left, d, d + Right, d + RightBack, d + Back)); }
fn from_int<I: Integer>(i: I) -> Direction
[src]
Create Direction from integer in [0, 6) range
This should probably be internal
fn to_int<I: Integer>(&self) -> I
[src]
Convert to integer in [0, 6) range
This should probably be internal
Trait Implementations
impl Copy for Direction
[src]
impl Clone for Direction
[src]
fn clone(&self) -> Direction
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Direction
[src]
impl PartialEq for Direction
[src]
fn eq(&self, __arg_0: &Direction) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Hash for Direction
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Direction
[src]
impl Ord for Direction
[src]
fn cmp(&self, __arg_0: &Direction) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for Direction
[src]
fn partial_cmp(&self, __arg_0: &Direction) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Decodable for Direction
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Direction, __D::Error>
[src]
Deserialize a value using a Decoder
.
impl ToDirection for Direction
[src]
fn to_direction(&self) -> Direction
[src]
Convert to Angle
part of this data
impl<T: ToDirection> Sub<T> for Direction
[src]
type Output = Angle
The resulting type after applying the -
operator.
fn sub(self, c: T) -> Angle
[src]
Performs the -
operation.
impl<I: Integer> ToCoordinate<I> for Direction
[src]
fn to_coordinate(&self) -> Coordinate<I>
[src]
Convert to Coordinate
part of this data
impl Neg for Direction
[src]
type Output = Direction
The resulting type after applying the -
operator.
fn neg(self) -> Direction
[src]
Performs the unary -
operation.