Solutions to Advent of Code problems 2021 in Rust.
This repository holds a single Rust project that contains all the days.
The command line tool takes <day> <part>
as arguments and reads the problem input from stdin
.
To run the solution for the first part of day 1
you can run:
$ cat src/year2021/day01_input.txt | cargo run -q 1 2
To add a new solution (day), you need to:
- Create a file
day01.rs
undersrc/year2021
; - Add a function
pub fn solve(input: &mut Input) -> Result<u32, String>
under that file; - Export the function in
src/year2021/mod.rs
;
Execute this command to setup git hooks:
git config --local core.hooksPath ./hooks