pub enum Direction {
North,
NorthEast,
NorthWest,
East,
South,
SouthEast,
SouthWest,
West,
}Expand description
A direction in the 2D plane.
Variants§
Implementations§
Source§impl Direction
impl Direction
pub const CARDINAL: [Direction; 4]
pub const DIAGONAL: [Direction; 4]
pub const ALL: [Direction; 8]
Sourcepub fn iter_cardinal() -> impl Iterator<Item = Direction>
pub fn iter_cardinal() -> impl Iterator<Item = Direction>
Iterate N, E, S, W directions.
Sourcepub fn iter_diagonal() -> impl Iterator<Item = Direction>
pub fn iter_diagonal() -> impl Iterator<Item = Direction>
Iterate NE, NW, SE, SW directions.
Sourcepub fn move_ipoint(&self, point: IVec2, by: i32) -> IVec2
pub fn move_ipoint(&self, point: IVec2, by: i32) -> IVec2
Move a point in this direction by the given amount.
Sourcepub fn move_upoint(&self, point: UVec2, by: u32) -> UVec2
pub fn move_upoint(&self, point: UVec2, by: u32) -> UVec2
Move a point in this direction by the given amount. Limits the lower bounds to zero.
Sourcepub fn is_cardinal(&self) -> bool
pub fn is_cardinal(&self) -> bool
Returns true if this direction is cardinal (N, E, S, W).
Sourcepub fn is_diagonal(&self) -> bool
pub fn is_diagonal(&self) -> bool
Returns true if this direction is diagonal (NE, NW, SE, SW).
Trait Implementations§
impl Copy for Direction
impl Eq for Direction
impl StructuralPartialEq for Direction
Auto Trait Implementations§
impl Freeze for Direction
impl RefUnwindSafe for Direction
impl Send for Direction
impl Sync for Direction
impl Unpin for Direction
impl UnwindSafe for Direction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more