File: time_iterator.rs

package info (click to toggle)
rust-tiny-bench 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: makefile: 4
file content (17 lines) | stat: -rw-r--r-- 311 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::time::Duration;
use tiny_bench::Timeable;

pub fn main() {
    let v = (0..100)
        .map(|a| {
            my_expensive_call();
            a
        })
        .timed()
        .max();
    assert_eq!(99, v.unwrap());
}

fn my_expensive_call() {
    std::thread::sleep(Duration::from_millis(5));
}