initial framework
This commit is contained in:
parent
fffd510441
commit
7113dce66f
10 changed files with 286 additions and 0 deletions
3
src/lib.rs
Executable file
3
src/lib.rs
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
pub mod utils;
|
||||
|
||||
pub mod problems;
|
||||
10
src/main.rs
Executable file
10
src/main.rs
Executable 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}");
|
||||
});
|
||||
}
|
||||
3
src/problems/day01/mod.rs
Normal file
3
src/problems/day01/mod.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
pub fn solution() -> String {
|
||||
"<todo>".to_string()
|
||||
}
|
||||
1
src/problems/mod.rs
Normal file
1
src/problems/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod day01;
|
||||
10
src/utils/mod.rs
Normal file
10
src/utils/mod.rs
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue