We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0390c7 commit 1e9a91eCopy full SHA for 1e9a91e
aoc/src/lib.rs
@@ -2,12 +2,14 @@ pub mod algs;
2
pub mod get_mut;
3
pub mod iterstuff;
4
pub mod stringstuff;
5
+mod time;
6
pub mod tree;
7
pub mod unionfind;
8
9
pub use aoc_macro::input_str;
10
pub use get_mut::GetMany;
11
pub use iterstuff::IterJunk;
12
+pub use time::time;
13
pub use tree::{Node, Tree};
14
pub use unionfind::UnionFind;
15
aoc/src/time.rs
@@ -0,0 +1,9 @@
1
+pub fn time<F, T>(task: &str, f: F) -> T
+where
+ F: FnOnce() -> T,
+{
+ let start = std::time::Instant::now();
+ let result = f();
+ println!("{}: {:?}", task, start.elapsed());
+ result
+}
0 commit comments