Advent of Code helper
This crate provides a macro to generate a handful main for your advent of code participation. The intention is to provide something similar to cargo-aoc through a much simple code base.
Currently this will only provide a few benefits:
- a somewhat pretty orchestration of your solutions
- automatic download and loading of your input files
- generation of criterion benchmarks
Usage
The generator and solutions for a given day must be implemented in a module
called dayX
. Then you can simply invoke the aoc_main::main!
macro in your
main.rs
:
!
main
Then you can simply run cargo run
!
Note that your solutions must take a borrowed version of the generator's output. Also, the generator can output a structure that contains borrowed data from the original input file.
Benchmarks
You can run Criterion benchmarks by running cargo run --release -- --bench
,
but first you need to enable the bench
feature in your cargo.toml:
[]
= { = "*", = ["bench"] }
Fetching your AOC token
When the command line asks you for your session token, you can apply the following procedure (quoted from cargo-aoc):
- Firefox: "Storage" tab, Cookies, and copy the "Value" field of the session cookie.
- Google Chrome / Chromium: "Application" tab, Cookies, and copy the "Value" field of the session cookie.
If you wish to change or forget your connection token, you will have to remove
aoc
in your config directory (eg. $HOME/.config/aoc
for linux users).