Build status on GitLab CI Newest release on crates.io Documentation Number of downloads on crates.io Project license

took: easily measure & report elapsed time

I always find measuring and reporting run time of code it in a human readable format troublesome.

This crate provides a few simple interfaces to do just that.

Examples

Requirements

Usage

Add the dependencies in your Cargo.toml. The took-macro dependency is only required if you'll be using the #[took] attribute macro.

Cargo.toml [dependencies] took = "0.1" took-macro = "0.1" # if using macros

Import and start using:

```rust use took::{Timer, took};

let timer = Timer::new(); println!("Done! Took {}", timer.took());

let (took, result) = took(|| { // Run heavy task }); println!("Done, took {}", took); ```

If you'll be using #[took] attribute macro, explicitly import it:

```rust

[macro_use]

extern crate took_macro;

[took]

pub fn function_a() {}

[took(description = "Some function")]

pub fn function_a() {} ```

TODO

License

This project is released under the MIT license. Check out the LICENSE file for more information.