Skip to content

Releases: gobanos/cargo-aoc

Version 0.3.7

02 Dec 00:09
Compare
Choose a tag to compare

Fix reqwest feature, thanks to @darin-costello

Version 0.3.6

01 Dec 21:46
Compare
Choose a tag to compare

Fix credentials setting snippet in readme by @williammartin
Use rustls feature for reqwest by @NilsIrl
Adjust error message with the current signature
Split generator bench on each part

Version 0.3.5

30 Nov 19:47
Compare
Choose a tag to compare

Generate boilerplate automatically by @dev-ardi
Download all files for a given year by @dev-ardi

Fix cargo aoc syntax
Bump criterion
Bump various libs
Add a graceful error message when metadata are missing

Version 0.3.4

25 Mar 08:46
Compare
Choose a tag to compare

Version 0.3.3

01 Dec 22:55
Compare
Choose a tag to compare

Add custom user agent (closes #88)
Bump a few deps

Version 0.3.2

12 Dec 10:58
Compare
Choose a tag to compare
Backport #44

cargo-aoc 0.2.0

06 Dec 00:46
3f0261a
Compare
Choose a tag to compare

Summary

Generators & Runners now support Results and Options in return position.
You can benchmark generators too, using cargo aoc bench -g.
Input is automatically trimmed.
aoc-runner-derive no longer flood your doc !

Setup

In your Cargo.toml:

aoc-runner = "0.2.0"
aoc-runner-derive = "0.2.0"

In your terminal:
$ cargo install cargo-aoc --force --version 0.2.0

Examples

#[aoc_generator(day1)]
fn parse_input(input: &str) -> Result<Vec<i32>, ParseIntError> {
    input
        .lines()
        .map(|l| l.parse())
        .collect()
}

#[aoc(day1, part1)]
fn part1(freqs: &[i32]) -> i32 {
    freqs.iter().sum()
}

Known limitation

By far, the biggest limitation is that I need the return type to be called Result (it still can be prefixed with a path), with at least a template parameter.
So these wont work :

type MyRes = Result<Vec<i32>, ParseIntError>;

#[aoc_generator(day1)]
fn parse_input(input: &str) -> MyRes {
    ...
}
type Result = std::result::Result<Vec<i32>, ParseIntError>;

#[aoc_generator(day1)]
fn parse_input(input: &str) -> MyRes {
    ...
}

link to the doc