diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -5,7 +5,6 @@ array_windows, iter_intersperse, impl_trait_in_assoc_type, - macro_metavar_expr, slice_group_by )] @@ -33,24 +32,21 @@ pub use printer::Printer; pub type Result<T, E = Box<dyn std::error::Error>> = std::result::Result<T, E>; -#[macro_export] -macro_rules! get_days { - // `()` indicates that the macro takes no argument. +macro_rules! days { ($($day:path),*) => { - pub fn get_days() -> [(&'static str, [Box<dyn Fn(&str) -> anyhow::Result<usize>>; 2]); ${count(day)}] { - [ + pub fn days() -> Vec<(&'static str, [Box<dyn Fn(&str) -> anyhow::Result<usize>>; 2])> { + vec![ $((<$day>::INPUT, [ Box::new(<$day>::part_1), Box::new(<$day>::part_2), - ]) - ,)* + ]),)* ] } }; } -get_days!( +days!( day_01::Day01, day_02::Day02, day_03::Day03, |