Macro-ify benches and unify days list to one file
Also update README with new options.
This commit is contained in:
12
src/days.rs
Normal file
12
src/days.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
// Single source of truth for all implemented days
|
||||
// Add new days here and they'll automatically be available in both the runner and benchmarks
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! all_days {
|
||||
($macro_name:path) => {
|
||||
$macro_name! {
|
||||
1 => day01,
|
||||
2 => day02,
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod day01;
|
||||
pub mod day02;
|
||||
pub mod days;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
mod days;
|
||||
mod runner;
|
||||
|
||||
pub mod day01;
|
||||
pub mod day02;
|
||||
use aoc::{day01, day02};
|
||||
|
||||
use clap::Parser;
|
||||
use color_eyre::Result;
|
||||
@@ -24,10 +24,7 @@ struct Args {
|
||||
part: Option<u8>,
|
||||
}
|
||||
|
||||
runner::days! {
|
||||
1 => day01,
|
||||
2 => day02,
|
||||
}
|
||||
all_days!(runner::days);
|
||||
|
||||
fn main() -> Result<()> {
|
||||
color_eyre::install()?;
|
||||
|
||||
Reference in New Issue
Block a user