My Rust solutions to Advent of Code 2018 challenges
My Rust solutions to Advent of Code 2018 challenges:
https://adventofcode.com/2018
Although one can devise much more succinct solutions
to some problems (write code in ad-hoc script
style and avoid over-engineering), my motivation was to:
Be correct and write the code such that it can be
easily tested. All the code has tests (test
coverage might not be 100%, but it’s pretty solid).
Apply defensive programming (assume the challenge
can have malformed input or might never
converge to a solution).
Learn more advanced Rust, in particular:
Testing.
“Production grade” error handling (never
panic, always return structured errors).
Generic programming and the trait system.
The 2018 edition!
To build & run, make sure you have Rust 1.31 or
above (using Rust 2018).
All code has tests, you can run all of them using:
$ cargo test
To run one a challenge, e.g. day01
, you need
to specify its name and path to input:
$ cargo run --bin day01 day01/input/input
Or to run in release mode:
$ cargo run --release --bin day01 day01/input/input