aoc2025/bram/rust/src/main.rs

53 lines
1.6 KiB
Rust

fn main() {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
let day : Option<u8> = args[1].parse().ok();
match day {
Some(1) => run_day(aoc2025::day_01),
Some(2) => run_day(aoc2025::day_02),
Some(3) => run_day(aoc2025::day_03),
Some(4) => run_day(aoc2025::day_04),
// Some(5) => run_day(aoc2025::day_05),
// Some(6) => run_day(aoc2025::day_06),
// Some(7) => run_day(aoc2025::day_07),
// Some(8) => run_day(aoc2025::day_08),
// Some(9) => run_day(aoc2025::day_09),
// Some(10) => run_day(aoc2025::day_10),
// Some(11) => run_day(aoc2025::day_11),
// Some(12) => run_day(aoc2025::day_12),
Some(_) => run_all_days(),
None => run_all_days(),
}
} else {
run_all_days();
}
}
fn run_all_days() {
let mut aoc = aoc2025::AdventOfCode::new();
aoc.insert(1, aoc2025::day_01());
aoc.insert(2, aoc2025::day_02());
aoc.insert(3, aoc2025::day_03());
aoc.insert(4, aoc2025::day_04());
// aoc.insert(5, aoc2025::day_05());
// aoc.insert(6, aoc2025::day_06());
// aoc.insert(7, aoc2025::day_07());
// aoc.insert(8, aoc2025::day_08());
// aoc.insert(9, aoc2025::day_09());
// aoc.insert(10, aoc2025::day_10());
// aoc.insert(11, aoc2025::day_11());
// aoc.insert(12, aoc2025::day_12());
aoc.show_diagnostics();
}
fn run_day(day : fn() -> aoc2025::DailyOutput) {
let (p1, p2, _) = day();
println!("Part 1: {}", p1);
println!("Part 2: {}", p2);
}