diff --git a/2022/src/day22.rs b/2022/src/day22.rs index 7f88bfb..9be8d06 100644 --- a/2022/src/day22.rs +++ b/2022/src/day22.rs @@ -28,6 +28,8 @@ enum Direction { Right = 0, } +type Map<'a> = Vec<&'a [u8]>; + impl Direction { fn turn_left(self) -> Self { match self { @@ -48,7 +50,7 @@ impl Direction { } } -fn parse_map(input: &[u8]) -> IResult<&[u8], (Vec<&[u8]>, Vec)> { +fn parse_map(input: &[u8]) -> IResult<&[u8], (Map, Vec)> { separated_pair( map(take_until("\n\n"), |map: &[u8]| { map.split(|&b| b == b'\n').collect()