adic_shape/shape/
direction.rs1#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
2pub enum Direction {
4 Up,
6 Down,
8 Left,
10 Right,
12}
13
14impl Direction {
15 #[must_use]
16 pub fn opposite(&self) -> Self {
18 match self {
19 Self::Up => Self::Down,
20 Self::Down => Self::Up,
21 Self::Left => Self::Right,
22 Self::Right => Self::Left,
23 }
24 }
25 #[must_use]
26 pub fn ccwise(&self) -> Self {
28 match self {
29 Self::Up => Self::Left,
30 Self::Down => Self::Right,
31 Self::Left => Self::Down,
32 Self::Right => Self::Up,
33 }
34 }
35 #[must_use]
36 pub fn cwise(&self) -> Self {
38 match self {
39 Self::Up => Self::Right,
40 Self::Down => Self::Left,
41 Self::Left => Self::Up,
42 Self::Right => Self::Down,
43 }
44 }
45}
46
47