Files
brk/_src/utils/time.rs
2025-02-23 01:25:15 +01:00

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
}