utils fixes
This commit is contained in:
2 files changed
+18
-1
No files matched your search
@@ -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>,
|
||||
|
||||
Reference in new issue
Block a user