1use crate::all_puzzles;
2use utils::date::Date;
3
4#[allow(clippy::allow_attributes, unused_imports)]
6use utils::{
7 PuzzleDate,
8 input::{InputError, InputType, strip_final_newline},
9};
10
11pub type PuzzleFn = fn(&str) -> Result<(String, String), InputError>;
15
16macro_rules! matcher {
17 ($(
18 $y:literal => $year:ident{$(
19 $d:literal => $day:ident,
20 )*}
21 )*) => {
22 pub static PUZZLES: &[(Date, PuzzleFn)] = &[$($(
29 (crate::$year::$day::DATE, |input: &str| {
30 let input = strip_final_newline(input);
31 let solution = crate::$year::$day::new(input, InputType::Real)?;
32 let part1 = solution.part1();
33 let part2 = solution.part2();
34 Ok((part1.to_string(), part2.to_string()))
35 }),
36 )*)*];
37 };
38}
39all_puzzles!(matcher);