1#[derive(Debug, Clone, Copy)]
5pub enum Direction {
6 Up,
7 Down,
8 Both,
9 None,
10}
11
12impl Direction {
13 pub fn is_down(&self) -> bool {
14 match self {
15 Direction::None | Direction::Up => false,
16 Direction::Both | Direction::Down => true,
17 }
18 }
19 pub fn is_up(&self) -> bool {
20 match self {
21 Direction::Both | Direction::Up => true,
22 Direction::None | Direction::Down => false,
23 }
24 }
25}
26
27#[derive(Debug, Clone, Copy)]
28pub enum Orientation {
29 TopToBottom,
30 LeftToRight,
31}
32
33impl Orientation {
34 pub fn is_top_to_bottom(&self) -> bool {
35 if let Orientation::TopToBottom = self {
36 return true;
37 }
38 false
39 }
40 pub fn is_left_right(&self) -> bool {
41 if let Orientation::TopToBottom = self {
42 return false;
43 }
44 true
45 }
46 pub fn flip(&self) -> Orientation {
47 if let Orientation::TopToBottom = self {
48 return Orientation::LeftToRight;
49 }
50 Orientation::TopToBottom
51 }
52}