| Crates.io | aoc-toolbox |
| lib.rs | aoc-toolbox |
| version | 0.5.1 |
| created_at | 2022-07-21 14:18:08.44669+00 |
| updated_at | 2024-12-16 10:05:08.488808+00 |
| description | An helping framework to Advent of Code |
| homepage | https://gitlab.com/RomainGiraud/aoc-toolbox |
| repository | https://gitlab.com/RomainGiraud/aoc-toolbox |
| max_upload_size | |
| id | 629673 |
| size | 30,293 |
aoc-toolbox is a Rust library designed to simplify your Advent of Code experience. With this toolbox, you can:
Add the following dependency:
cargo add aoc-toolbox
Use the #[aoc_solver] macro to annotate your solver functions. For example:
use aoc_toolbox::aoc_solver;
#[aoc_solver("day01", "part1")]
fn solve_part1(input: String) -> String {
// Your solution logic here
}
#[aoc_solver("day01", "part2", "result")]
fn solve_part1(input: String) -> String {
// Your solution logic here
}
If you provide a third argument to the aoc_solver macro, it will be tested against the output of the solver. This is useful for validating your solutions.
In that case, the output will be green or red depending on whether the result matches the expected value.
Use the aoc_main! macro in your main.rs file to tie everything together:
use aoc_toolbox::aoc_main;
mod day01;
aoc_main! { 2024 }
You must provide a .txt file as input for each day, located at: input/day01.txt. The solver will automatically load the appropriate file based on the selected day.
The aoc_main! macro will generate a main function that:
cargo run -- --help
cargo run -- --list
cargo run -- day01 # run all solvers for day 1
cargo run -- day01::part1 # run a specific solver
String as input and also return a String.This tool was initially created for personal use during Advent of Code, but it's now available for anyone who finds it helpful. Enjoy hacking away at those puzzles! 🎄✨