diff options
| author | LLLL Colonq <llll@colonq> | 2024-06-16 21:00:23 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-06-16 21:00:23 -0400 |
| commit | 19dd50105290dcfde80bd1673064386e501f631c (patch) | |
| tree | d025b4ad4b1506951bf5f7000281e92486639069 | |
| parent | 979b95219635d3b0b04e2e00c72e8fd43b4a8e96 (diff) | |
Cardinal to string
| -rw-r--r-- | src/utils.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs index bd435af..9f2e0d2 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,6 +7,15 @@ pub enum Cardinal { } impl Cardinal { + pub fn to_string(&self) -> &'static str { + match self { + Self::North => "north", + Self::South => "south", + Self::West => "west", + Self::East => "east", + } + } + pub fn turn_cw(&self) -> Self { match self { Self::North => Self::East, |
