add readme

This commit is contained in:
LordMZTE 2021-12-04 23:36:57 +01:00
parent 4773676ec5
commit 594c177f03
1 changed files with 39 additions and 0 deletions

39
README.md Normal file
View File

@ -0,0 +1,39 @@
# libaoc
A library for writing very rusty AdventOfCode solutions with miette error handling.
## Example
```rust
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!'
```