Crate yaah

Crate yaah 

Source
Expand description

§yaah – Yet Another AOC Helper for your Advent Of Code adventures

This crate handles the boilerplate around fetching, running and benchmarking your input parsing and solution implementations. It is inpired by the excellent cargo-aoc cargo extentions.

§Setup

This helper will automatically fetch your personnal input file provided you set your AOC session cookie in the AOC_SESSION environment variable. This can be either done through your favorite shell or in a .cargo/config.toml file as such:

[env]
AOC_SESSION = "your super long session secret extracted from your browser's cookie jar"

Note that this .cargo directory can reside in a parent directory of your project allowing you to have a project specific version controlled cargo config file without leaking your session secret.

If you want to benefit from the auto-generated main function, you will need to add a dependency to clap.

clap = { version = "4.0", features = ["derive"] }

If you want to benefit from the auto-generated bench marks, your project’s manifest will require these extra elements:

[dependencies]
criterion = "0.4.0"

[[bench]]
# Adjust that name to that of your file in the `./benches` directory.
name = "aoc-bench"
harness = false

For your convenience a template project is availble. Simply bootstrap your Advent of code with:

cargo generate --git https://github.com/ithinuel/yaah-template.git

Macros§

aoc_bench
Generates the benchmarks
aoc_lib
Generates the solver methods used by the main function and the benchmarks.
aoc_main
Generates the main function
aoc_year
Sets the year for the solutions

Attribute Macros§

aoc
Attribute for the solver functions
aoc_generator
Attribute for the generator functions