mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-26 07:39:59 -07:00
brk: first commit
This commit is contained in:
18
_src/utils/time.rs
Normal file
18
_src/utils/time.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use log::info;
|
||||
|
||||
use crate::structs::DisplayInstant;
|
||||
|
||||
pub fn time<F, T>(text: &str, function: F) -> T
|
||||
where
|
||||
F: FnOnce() -> T,
|
||||
{
|
||||
let time = Instant::now();
|
||||
|
||||
let returned = function();
|
||||
|
||||
info!("{text} {}", time.display());
|
||||
|
||||
returned
|
||||
}
|
||||
Reference in New Issue
Block a user