Skip to content

Commit 094dc84

Browse files
committed
Add Grid::set method
1 parent 8c48466 commit 094dc84

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/grid/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ impl Grid {
8181
(0..self.height).contains(&r) && (0..self.width).contains(&c)
8282
}
8383

84+
/// Set a grid element by index.
85+
pub fn set(&mut self, index: usize, val: char) {
86+
self.grid[index] = val;
87+
}
88+
8489
/// Find first index of c in the grid
8590
pub fn find_char(&self, ch: char) -> Option<usize> {
8691
self.grid

0 commit comments

Comments
 (0)