[−][src]Function tweetr::util::span_r
pub fn span_r<F, R>(f: F) -> (ChronoDuration, R) where
F: FnOnce() -> R,
Runs a closure, returning the duration of time it took to run the closure and the closure's return value.
Equivalent to https://github.com/rust-lang-deprecated/time/pull/139
Examples
let (dur, i) = span_r(|| { thread::sleep(Duration::from_millis(10)); 420 }); assert_eq!(i, 420); assert!(dur.num_milliseconds() >= 10);