seq-timer 0.1.0

A simple timer for sequential events
Documentation
  • Coverage
  • 66.67%
    4 out of 6 items documented1 out of 6 items with examples
  • Size
  • Source code size: 11.89 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.28 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • imbolc/seq-timer
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • imbolc

License Crates.io Docs.rs

seq-timer

A simple timer for sequential events

use std::{ time::Duration, thread::sleep };

let mut timer = seq_timer::Timer::new();

// starts the first event
timer.start("the first event");
sleep(Duration::from_millis(1));

// finishes the first event and starts the second one
// you can also `.finish()` the current event manually
timer.start("the second event");
sleep(Duration::from_millis(10));

// finishes the last event and prints sorted measurments to stdout:
timer.print();

The output would be similar to:

the second event | 10078204 ns |  88%
 the first event |  1265423 ns |  11%

The timer also implements Display, but you must finish the last event manually in this case: debug!("{}", timer.finish())

Contributing

We appreciate all kinds of contributions, thank you!

Note on README

The README.md file isn't meant to be changed directly. It instead generated from the crate's docs by the cargo-readme command:

  • Install the command if you don't have it: cargo install cargo-readme
  • Change the crate-level docs in src/lib.rs, or wrapping text in README.tpl
  • Apply the changes: cargo readme > README.md

If you have rusty-hook installed the changes will apply automatically on commit.

License

This project is licensed under the MIT license.