diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-12-24 12:08:13 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-12-24 12:08:13 -0500 |
commit | 4cae21c7b20f0e4480fc8f0d113d89e2bd2b8de5 (patch) | |
tree | 36c8c9cdebb93a5716b8620aab391281c86199c8 /src/grid.rs | |
parent | f015a54fb2d23c4945e10a2d2dc7e2fcfe6645a2 (diff) | |
download | advent-of-code-4cae21c7b20f0e4480fc8f0d113d89e2bd2b8de5.tar.gz advent-of-code-4cae21c7b20f0e4480fc8f0d113d89e2bd2b8de5.zip |
day 24
Diffstat (limited to 'src/grid.rs')
-rw-r--r-- | src/grid.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/grid.rs b/src/grid.rs index 347c902..d988ec6 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -76,6 +76,34 @@ impl std::ops::Sub<Col> for usize { } } +impl std::ops::Rem<usize> for Row { + type Output = Self; + fn rem(self, other: usize) -> Self::Output { + Self(self.0 % other) + } +} + +impl std::ops::Rem<Row> for usize { + type Output = Row; + fn rem(self, other: Row) -> Self::Output { + Row(self % other.0) + } +} + +impl std::ops::Rem<usize> for Col { + type Output = Self; + fn rem(self, other: usize) -> Self::Output { + Self(self.0 % other) + } +} + +impl std::ops::Rem<Col> for usize { + type Output = Col; + fn rem(self, other: Col) -> Self::Output { + Col(self % other.0) + } +} + #[derive( Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug, Default, )] |