Attribute Macro aoc_runner_derive::aoc
source · #[aoc]
Expand description
Solution meta
Use this to flag a function as a solution for a given day :
#[aoc(day1, part1)]
You can also add a custom name to the function :
#[aoc(day1, part1, Bytes)]
, it’s useful to have multiple solutions to a given day & part and compare them !
The function must take a single parameter : a &str
or a &[u8]
, unless you use a generator
and return any type implementing Display
.
Results & Options
Since 0.2.0, you can output Result
& Option
from solution function, with the following constraints :
- the output type must be named
Result
orOption
,type CustomResult<T> = Result<T, CustomError>;
cannot be used in return position. - the first generic parameter must implement
Display
- for
Result
s, the error must implementInto<std::error::Error>
You still can use a path before the Result
/Option
, like this : std::io::Result<i32>