summaryrefslogtreecommitdiffstats
path: root/src/grid.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-12-24 12:08:13 -0500
committerJesse Luehrs <doy@tozt.net>2022-12-24 12:08:13 -0500
commit4cae21c7b20f0e4480fc8f0d113d89e2bd2b8de5 (patch)
tree36c8c9cdebb93a5716b8620aab391281c86199c8 /src/grid.rs
parentf015a54fb2d23c4945e10a2d2dc7e2fcfe6645a2 (diff)
downloadadvent-of-code-4cae21c7b20f0e4480fc8f0d113d89e2bd2b8de5.tar.gz
advent-of-code-4cae21c7b20f0e4480fc8f0d113d89e2bd2b8de5.zip
day 24
Diffstat (limited to 'src/grid.rs')
-rw-r--r--src/grid.rs28
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,
)]