macro_rules! time_fn {
($func:expr) => { ... };
}
Expand description
Macro to time a function call and record the result
ยงExamples
let (result, duration) = time_fn!({
// Some work to time
std::thread::sleep(std::time::Duration::from_millis(10));
"done"
});
assert!(duration >= std::time::Duration::from_millis(10));
assert_eq!(result, "done");