libaoc is a library for easily creating AdventOfCode solutions in rust.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LordMZTE 594c177f03 add readme 1 year ago
libaoc allow trailing comma on run_days macro 1 year ago
libaoc-macros init 1 year ago
.gitignore init 1 year ago
Cargo.toml init 1 year ago
README.md add readme 1 year ago

README.md

libaoc

A library for writing very rusty AdventOfCode solutions with miette error handling.

Example

fn main() -> libaoc::miette::Result<()> {
    libaoc::run_days!(day1)
}

// This could also be a new file with #![...] at the start using nightly rust!
#[libaoc::day(1, "../input/day1.txt")]
mod day1 {
    use libaoc::miette::Result;

    fn part1() -> Result<()> {
        println!("Running part 1. My input is '{}'", INPUT);

        Ok(())
    }

    // This is optional.
    fn part2() -> Result<()> {
        println!("Running part 2. My input is '{}'", INPUT);

        Ok(())
    }
}

This gives the output

Running day 1...
--- Part 1 ---
Running part 1. My input is 'day 1 input file here!'

--- Part 2 ---
Running part 2. My input is 'day 1 input file here!'