diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-12-15 01:56:48 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-12-15 01:56:48 -0500 |
commit | 8c2d4fdbc6dac9d568b32d853baf698b84aca68f (patch) | |
tree | 65e6fa36c12ad1d429a26afe8e9df2bbd7487bdf /src/grid.rs | |
parent | 41bd54af7fd1ebd28122584abe811c7076571bc0 (diff) | |
download | advent-of-code-8c2d4fdbc6dac9d568b32d853baf698b84aca68f.tar.gz advent-of-code-8c2d4fdbc6dac9d568b32d853baf698b84aca68f.zip |
day 15
Diffstat (limited to 'src/grid.rs')
-rw-r--r-- | src/grid.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/grid.rs b/src/grid.rs index 659ef01..f099189 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -2,11 +2,24 @@ Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug, Default, )] pub struct Row(pub usize); + #[derive( Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug, Default, )] pub struct Col(pub usize); +impl Row { + pub fn abs_diff(self, other: Self) -> Self { + Self(self.0.abs_diff(other.0)) + } +} + +impl Col { + pub fn abs_diff(self, other: Self) -> Self { + Self(self.0.abs_diff(other.0)) + } +} + impl std::ops::Add<usize> for Row { type Output = Self; fn add(self, other: usize) -> Self::Output { |