diff options
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 { |