initial framework

This commit is contained in:
Thorn Avery 2023-11-30 09:20:44 +11:00
parent fffd510441
commit 7113dce66f
10 changed files with 286 additions and 0 deletions

3
src/lib.rs Executable file
View file

@ -0,0 +1,3 @@
pub mod utils;
pub mod problems;

10
src/main.rs Executable file
View file

@ -0,0 +1,10 @@
use taoc2023::problems::*;
use taoc2023::utils::timeit;
fn main() {
println!("== day 01 ==");
timeit(|| {
let res = day01::solution();
println!("solution: {res}");
});
}

View file

@ -0,0 +1,3 @@
pub fn solution() -> String {
"<todo>".to_string()
}

1
src/problems/mod.rs Normal file
View file

@ -0,0 +1 @@
pub mod day01;

10
src/utils/mod.rs Normal file
View file

@ -0,0 +1,10 @@
use std::time::SystemTime;
pub fn timeit<F: Fn() -> T, T>(f: F) -> T {
let start = SystemTime::now();
let result = f();
let end = SystemTime::now();
let duration = end.duration_since(start).unwrap();
println!("duration: {} milliseconds", duration.as_millis());
result
}