From 19dd50105290dcfde80bd1673064386e501f631c Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Sun, 16 Jun 2024 21:00:23 -0400 Subject: Cardinal to string --- src/utils.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/utils.rs') 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, -- cgit v1.2.3