A rust template for Advent of Code.
- Clone this repo.
- Setup your environment:
export AOC_YEAR=<year>
export AOC_SESSION=<Your session key>
export AOC_INPUT=<Your input directory>
- Run ONCE:
cargo build
- Delete
build.rs
- you don't need to build again.
- Download the day's file:
cargo run -- init <day>
. The file will be downloaded into theAOC_INPUT
directory. - Write your code in the "day" files in
src/solutions/dayX.rs
- Build and run your code:
cargo run -- run <day> [--part <part>] [--extra arg1 arg2 arg3] [--input path/to/input]
- The arguments within [ ] are optional.
- Skipping
--part
will run both part 1 and part 2. - Skipping
--extra
will give an emptyVec<T>
of extra args. - Skipping
--input
will look for the download input inAOC_INPUT
.
- The module name is aoc-2020 but the template should work for any year
- The solution files are part of the same crate and so, their dependencies are shared.
build.rs
is very brittle and made only for the initial state of the repo.- The author in
Cargo.toml
is me. Change it if you want.
Do not run build.rs
after you have started writing your code.