1
Fork 0
advent-of-code/source/main.rs

55 lines
919 B
Rust

use std::time::{Duration, Instant};
use color_eyre::Result;
mod day_01;
mod day_02;
mod day_03;
mod day_04;
mod day_05;
mod day_06;
mod day_07;
mod day_08;
mod day_09;
mod day_10;
mod day_13;
mod day_14;
mod day_15;
fn main() -> Result<()> {
color_eyre::install()?;
println!("Advent of Code 2021\n");
let mut runtimes = vec![];
let days: Vec<fn() -> Result<()>> = vec![
day_01::solve,
day_02::solve,
day_03::solve,
day_04::solve,
day_05::solve,
day_06::solve,
day_07::solve,
day_08::solve,
day_09::solve,
day_10::solve,
day_13::solve,
day_14::solve,
day_15::solve,
];
for day in days {
let start = Instant::now();
day()?;
let runtime = Instant::now() - start;
runtimes.push(runtime);
println!("- Runtime: {:#?}\n", runtime);
}
println!(
"Total runtime: {:#?}",
runtimes.into_iter().sum::<Duration>()
);
Ok(())
}