diff options
Diffstat (limited to '2021/rust/day02')
-rw-r--r-- | 2021/rust/day02/src/main.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/2021/rust/day02/src/main.rs b/2021/rust/day02/src/main.rs index 4178ecc..d093dba 100644 --- a/2021/rust/day02/src/main.rs +++ b/2021/rust/day02/src/main.rs @@ -91,7 +91,7 @@ fn read_input<T: AsRef<Path>>(filename: T) -> Result<Vec<Command>> { ).collect() } -fn part1(input: &[Command]) -> Result<Position> { +fn part1<'a, I: IntoIterator<Item = &'a Command>>(input: I) -> Result<Position> { let mut position = Position { x: 0, y:0 }; for command in input { match command { @@ -104,7 +104,7 @@ fn part1(input: &[Command]) -> Result<Position> { Ok(position) } -fn part2(input: &[Command]) -> Result<Position> { +fn part2<'a, I: IntoIterator<Item = &'a Command>>(input: I) -> Result<Position> { let mut position = Position { x: 0, y:0 }; let mut aim = 0; for command in input { |