#toolbox #advent-of-code #helper #aoc

macro aoc-toolbox-derive

Macros implementation of aoc-toolbox

5 releases (3 breaking)

0.4.1 Aug 1, 2022
0.4.0 Jul 31, 2022
0.3.0 Jul 26, 2022
0.2.0 Jul 26, 2022
0.1.0 Jul 21, 2022

#12 in #adventofcode


Used in aoc-toolbox

MIT/Apache

8KB
136 lines

csv-export

About

Advent of code tools.

Installation

Import the following packages in your crate:

aoc-toolbox = "0.4"

Usage

Main generation

You can mark solvers in your code:

use aoc_toolbox::aoc_solver;

#[aoc_solver("day01", "part1")]
fn solve_day01_part1(input: String) -> String {
    // ...
}

And then at the end of your main.rs, you can call this macro:

use aoc_toolbox::aoc_main;

aoc_main!(2021);

Limitations

  • For the moment, macros do not have context. Their state is not saved between calls (see this issue). I use a hack to save an internal state, so problems can appear...
  • Each solver must have the following signature:
    fn (input: String) -> String;
    

Motivation

This tool was intended for my purpose only.

I choosed to release it, so anyone can use it. Enjoy!

Dependencies

~1.5MB
~35K SLoC