mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 22:59:58 -07:00
19 lines
276 B
Rust
19 lines
276 B
Rust
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
|
|
}
|