Advent of Code solutions

Cleanup of grid.rs

bwc9876.dev 8b114d23 7ce848a2

verified
+2 -4
+2 -4
utils/src/grid.rs
··· 570 570 } 571 571 } 572 572 573 - impl<T> Grid<T> 574 - where 575 - T: Eq, 576 - { 573 + impl<T: Eq> Grid<T> { 577 574 pub fn find_tile(&self, tile: &T) -> Option<Position> { 578 575 self.iter() 579 576 .find_map(|(p, t)| if t == tile { Some(p) } else { None }) ··· 841 838 self.pos = self.pos.move_dir(self.dir); 842 839 } 843 840 841 + /// See what tile (if any) the cursor will go to if it would move forward 844 842 pub fn peek_forward(&self) -> Option<(Position, &T)> { 845 843 let next_pos = self.pos.move_dir(self.dir); 846 844 self.grid.get(next_pos).map(|value| (next_pos, value))