Implement 2023 day 13 part 1

This commit is contained in:
2023-12-13 18:21:19 +01:00
parent e449672487
commit 0838646973
3 changed files with 113 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
//! Common helper utilities to all days
use std::cmp::Ordering;
use std::fmt;
use std::fmt::Display;
use std::ops::Add;
use std::ops::Div;
use std::ops::Index;
@@ -292,3 +294,9 @@ impl<'a> Index<usize> for Grid<'a> {
&self.data[offset..(offset + self.width())]
}
}
impl Display for Grid<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", String::from_utf8_lossy(self.data))
}
}