maze/
maze_path_direction.rs

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
/// Represents a direction relative to a location
/// # Variants
/// - `Up`: Up 
/// - `Down`: Down
/// - `Left` - Left
/// - `Right` - Right
pub enum MazePathDirection {
    Up,
    Down,
    Left,
    Right,
    None,
}

impl MazePathDirection {
    /// Returns the unicode character associated with the given direction instance
    /// # Returns
    ///
    /// Unicode character
    pub fn unicode_char(&self) -> char {
        match self {
            MazePathDirection::Up => '\u{2191}',
            MazePathDirection::Down => '\u{2193}',
            MazePathDirection::Left => '\u{2190}',
            MazePathDirection::Right => '\u{2192}',
            MazePathDirection::None => '.',
        }
    }
}