toolchest 0.1.0

Essential utility collection for Rust - the missing complement to itertools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::time::Duration;
use toolchest::{random, time};

fn main() {
    let choice = random::random_choice(&["red", "green", "blue"]).unwrap();
    println!("choice: {}", choice);

    let (val, took) = time::elapsed(|| {
        std::thread::sleep(Duration::from_millis(20));
        42
    });
    println!("val={}, elapsed={}", val, time::duration_humanize(took));
}