#[aoc_generator]Expand description
§Generator meta
Use a generator when you need to pre-process your input :
§Usage
Generator meta have 3 forms :
- a generator for the whole day :
#[aoc_generator(day1)] - a generator for a single part :
#[aoc_generator(day1, part1)] - a generator for a single (named) solution:
#[aoc_generator(day1, part1, Bytes)]
The function must take a single parameter : a &str or a &[u8], and output any sized type.
The corresponding solutions now take any parameter for which Borrow is implemented.
§Results & Options
Since 0.2.0, you can output Result & Option from generator function, with the following constraints :
- the output type must be named
ResultorOption,type CustomResult<T> = Result<T, CustomError>;cannot be used in return position. - for
Results, the error must implementInto<std::error::Error>
You still can use a path before the Result/Option, like this : std::io::Result<i32>
§Note
A generator must be declared before it’s solutions.