pub enum Rotation {
None = 0,
Clockwise = 1,
Flip = 2,
Anticlockwise = 3,
}
Expand description
Variants§
None = 0
No rotation (0°)
Clockwise = 1
Rotate 90° clockwise
Flip = 2
Rotate 180°
Anticlockwise = 3
Rotate 90° anticlockwise
Implementations§
source§impl Rotation
impl Rotation
sourcepub fn is_turn(self) -> bool
pub fn is_turn(self) -> bool
Check if a rotation is a turn; that is, if it is Clockwise
or
Anticlockwise
Example
use gridly::rotation::*;
assert!(!Rotation::None.is_turn());
assert!(!Rotation::Flip.is_turn());
assert!(Clockwise.is_turn());
assert!(Anticlockwise.is_turn());
sourcepub fn reverse(self) -> Self
pub fn reverse(self) -> Self
Get the rotation in the opposite direction. Note that Rotation::None
and
Rotation::Flip
are their own opposites.
Example
use gridly::rotation::*;
assert_eq!(Rotation::None.reverse(), Rotation::None);
assert_eq!(Rotation::Flip.reverse(), Rotation::Flip);
assert_eq!(Clockwise.reverse(), Anticlockwise);
assert_eq!(Anticlockwise.reverse(), Clockwise);
Trait Implementations§
source§impl AddAssign for Rotation
impl AddAssign for Rotation
source§fn add_assign(&mut self, rhs: Rotation)
fn add_assign(&mut self, rhs: Rotation)
Performs the
+=
operation. Read moresource§impl PartialEq for Rotation
impl PartialEq for Rotation
source§impl SubAssign for Rotation
impl SubAssign for Rotation
source§fn sub_assign(&mut self, rhs: Rotation)
fn sub_assign(&mut self, rhs: Rotation)
Performs the
-=
operation. Read moreimpl Copy for Rotation
impl Eq for Rotation
impl StructuralEq for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnwindSafe for Rotation
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