Extend the functional programming abilities by adding iterators over the columns and the rows.
Two new methods are added to Grid::grid
pub fn iter_rows(&self) -> GridRowIter<'_, T>
pub fn iter_cols(&self) -> GridColIter<'_, T>
Where the new structs GridRowIter and GridColIter are wrappers around the existing grid.iter_col and grid.iter_row that keep track of the current index.
This feature reduces the risk of index errors when iterating over rows or columns.
Feedback and criticism is welcome. I'm planning on adding a mutable version of the two iterators in the future.
Extend the functional programming abilities by adding iterators over the columns and the rows.
Two new methods are added to
Grid::grid
pub fn iter_rows(&self) -> GridRowIter<'_, T>
pub fn iter_cols(&self) -> GridColIter<'_, T>
Where the new structs
GridRowIter
andGridColIter
are wrappers around the existinggrid.iter_col
andgrid.iter_row
that keep track of the current index.This feature reduces the risk of index errors when iterating over rows or columns.
Feedback and criticism is welcome. I'm planning on adding a mutable version of the two iterators in the future.