ibench 0.1.1

Extremely simple and small Rust library for quickly timing a closure
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::time::{Duration, Instant};

pub fn time(function: impl Fn()) -> Duration {
    let start = Instant::now();

    function();

    start.elapsed()
}

pub fn print_time(function: impl Fn()) {
    println!("{:?}", time(function));
}