pub enum Cardinal {
East,
North,
West,
South,
}
Expand description
An enumerator for the simple cardinal directions.
Variants§
Implementations§
Source§impl Cardinal
impl Cardinal
Sourcepub fn iter_values() -> impl Iterator<Item = Self>
pub fn iter_values() -> impl Iterator<Item = Self>
Gives an iterator over the four cardinals
Sourcepub fn to_ivec2(self) -> (i32, i32)
pub fn to_ivec2(self) -> (i32, i32)
Converts to a simple tuple int form. This assumes that north is up.
Sourcepub fn from_angle(angle: f32) -> Cardinal
pub fn from_angle(angle: f32) -> Cardinal
This returns a cardinal as a best guess for floats. If you give an exactly divisible by 90 degrees, it’ll work just the way you expect.
Sourcepub fn is_horizontal(self) -> bool
pub fn is_horizontal(self) -> bool
Is either West or East
Sourcepub fn is_vertical(self) -> bool
pub fn is_vertical(self) -> bool
Is either North or South
Trait Implementations§
Source§impl<T> Index<Cardinal> for CardinalValues<T>
impl<T> Index<Cardinal> for CardinalValues<T>
Source§impl Ord for Cardinal
impl Ord for Cardinal
Source§impl PartialOrd for Cardinal
impl PartialOrd for Cardinal
impl Copy for Cardinal
impl Eq for Cardinal
impl StructuralPartialEq for Cardinal
Auto Trait Implementations§
impl Freeze for Cardinal
impl RefUnwindSafe for Cardinal
impl Send for Cardinal
impl Sync for Cardinal
impl Unpin for Cardinal
impl UnwindSafe for Cardinal
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