ttimer 0.1.3

A tiny crate used for timing individual functions
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented3 out of 4 items with examples
  • Size
  • Source code size: 5.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.43 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • sfrembling/timer
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sfrembling

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());
}