1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Contains utilities, enums, constants and simple data structures that are
//! used across the program.

#[derive(Debug, Clone, Copy)]
pub enum Direction {
    Up,
    Down,
    Both,
    None,
}

impl Direction {
    pub fn is_down(&self) -> bool {
        match self {
            Direction::None | Direction::Up => false,
            Direction::Both | Direction::Down => true,
        }
    }
    pub fn is_up(&self) -> bool {
        match self {
            Direction::Both | Direction::Up => true,
            Direction::None | Direction::Down => false,
        }
    }
}

#[derive(Debug, Clone, Copy)]
pub enum Orientation {
    TopToBottom,
    LeftToRight,
}

impl Orientation {
    pub fn is_top_to_bottom(&self) -> bool {
        if let Orientation::TopToBottom = self {
            return true;
        }
        false
    }
    pub fn is_left_right(&self) -> bool {
        if let Orientation::TopToBottom = self {
            return false;
        }
        true
    }
    pub fn flip(&self) -> Orientation {
        if let Orientation::TopToBottom = self {
            return Orientation::LeftToRight;
        }
        Orientation::TopToBottom
    }
}