diff --git a/Cargo.lock b/Cargo.lock index eff8c27..32005b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,6 +15,7 @@ dependencies = [ name = "aoc" version = "0.1.0" dependencies = [ + "enum-map", "num-traits", "strum 0.24.1", "thiserror", diff --git a/common/rust/Cargo.toml b/common/rust/Cargo.toml index ebe2750..96f2fee 100644 --- a/common/rust/Cargo.toml +++ b/common/rust/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +enum-map = "2.7.3" num-traits = "0.2.15" strum = { version = "0.24.1", features = ["derive"] } thiserror = "1.0.38" diff --git a/common/rust/src/vec2.rs b/common/rust/src/vec2.rs index f54c714..3f12bc4 100644 --- a/common/rust/src/vec2.rs +++ b/common/rust/src/vec2.rs @@ -4,6 +4,8 @@ use std::{ str::FromStr, }; +use enum_map::Enum; + #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Vec2 { pub x: i32, // increases toward right @@ -169,7 +171,7 @@ impl From for Vec2 { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Enum)] pub enum Direction { Up, Down,