ttimer

Crates.iottimer
lib.rsttimer
version0.1.3
sourcesrc
created_at2023-12-13 04:23:46.153095
updated_at2023-12-15 22:08:24.255203
descriptionA tiny crate used for timing individual functions
homepage
repositoryhttps://github.com/sfrembling/timer
max_upload_size
id1067662
size6,265
Shea Frembling (sfrembling)

documentation

README

ttimer

A simple and tiny timing crate.

Example Usage

// time a function's execution
let result = timer!(some_function);

println!("Took {} ns", result.time.as_nanos());

// time execution and use output
fn some_function(a: i32, b: &str) -> Option<usize> {
    /* code */
}

let result = timer!(some_function, 12, "Some input string");

if let Some(value) = result.result {
    println!("Took {} ns to find {}", result.time.as_nanos(), value);
} else {
    println!("Took {} ns", result.time.as_nanos());
}
Commit count: 11

cargo fmt