utils fixes

This commit is contained in:
ktims committed 2026-12-02 13:09:10 -07:00
1 parent bb5f7f52f6
commit 7143cfe0fd
2 files changed
+18 -1

No files matched your search

+17
View File
@@ -139,6 +139,23 @@ impl<'a, T> Iterator for GridRowIter<'a, T> {
}
}
#[derive(Debug)]
pub struct CoordIter<'a, T> {
pos: usize,
grid: &'a Grid<T>,
}
impl<'a, T: Clone + Eq + PartialEq + Debug> Iterator for CoordIter<'a, T> {
type Item = Coord2d;
fn next(&mut self) -> Option<Self::Item> {
if self.pos < self.grid.data.len() {
self.grid.coord(self.pos as i64).into()
} else {
None
}
}
}
#[derive(Debug)]
pub struct GridColIter<'a, T> {
grid: &'a Grid<T>,