summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-06-16 21:00:23 -0400
committerLLLL Colonq <llll@colonq>2024-06-16 21:00:23 -0400
commit19dd50105290dcfde80bd1673064386e501f631c (patch)
treed025b4ad4b1506951bf5f7000281e92486639069 /src
parent979b95219635d3b0b04e2e00c72e8fd43b4a8e96 (diff)
Cardinal to string
Diffstat (limited to 'src')
-rw-r--r--src/utils.rs9
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,