tangled
alpha
login
or
join now
bwc9876.dev
/
advent
0
fork
atom
Advent of Code solutions
0
fork
atom
overview
issues
pulls
pipelines
Cleanup of grid.rs
bwc9876.dev
1 year ago
8b114d23
7ce848a2
verified
This commit was signed with the committer's
known signature
.
bwc9876.dev
SSH Key Fingerprint:
SHA256:DanMEP/RNlSC7pAVbnXO6wzQV00rqyKj053tz4uH5gQ=
+2
-4
1 changed file
expand all
collapse all
unified
split
utils
src
grid.rs
+2
-4
utils/src/grid.rs
···
570
570
}
571
571
}
572
572
573
573
-
impl<T> Grid<T>
574
574
-
where
575
575
-
T: Eq,
576
576
-
{
573
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
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))