beautiful proc macro

This commit is contained in:
Rakarake 2025-11-30 18:57:32 +01:00
parent 9b822cedc8
commit f2a4de9bd9
6 changed files with 70 additions and 29 deletions

View file

@ -7,3 +7,6 @@ edition = "2024"
name = "aoc2024"
path = "main.rs"
[dependencies]
gendays = { workspace = true }

View file

@ -1,28 +1 @@
mod day1;
mod day2;
fn main() {
// part 1 or 2
let day = std::env::args().nth(1).expect("needs to specify day for first argument");
let part = std::env::args().nth(2).expect("needs to specify 1 or 2 for second argument");
if day == "day1" {
if part == "1" {
println!("{}", day1::part1());
} else if part == "2" {
println!("{}", day1::part2());
} else {
panic!("expecting 1 or 2 for argument 2")
}
}
if day == "day2" {
if part == "1" {
println!("{}", day2::part1());
} else if part == "2" {
println!("{}", day2::part2());
} else {
panic!("expecting 1 or 2 for argument 2")
}
}
}
gendays::gen_days![aoc2024];