No description
Find a file
2021-05-01 08:05:14 -04:00
src rustfmt 2021-05-01 08:05:14 -04:00
.gitignore updating .gitignore to ignore doc directory 2014-12-30 18:18:49 -05:00
.travis.yml adding travis.yml to try and get rust CI 2014-12-30 18:34:41 -05:00
Cargo.toml complete cargo.toml file. 2021-04-30 13:04:16 -04:00
LICENSE.txt update license. 2021-04-30 12:48:24 -04:00
README.md update readme. 2021-04-30 12:55:20 -04:00

Stopwatch2

Stopwatch V2

Support an Open Source Developer! ♥️
Become a patron

Read the documentation.

This crate is a simplified version of the work of ellisonch.

Features

  • Adds a simple stopwatch.
  • Can use multiple splits, even with pauses between them!
  • Simple to use with clear documentation.

Usage

Add the following to you Cargo.toml file:

stopwatch2 = "*"

Use the stopwatch like so:

use stopwatch2::*;

fn main() {
    let mut s = Stopwatch::default();
    s.start(); // Starts the stopwatch.
    s.start(); // Creates a new time span, which are commonly called "splits".
    s.stop(); // Stops the stopwatch.
    println!("{}", s); // Prints the total time.
    println!("{:?}", s); // Prints the different time spans as debug information.
    let total_time = s.elapsed(); // returns the total time as a Duration.
    for span in &s.spans {
        // Prints all contained time spans.
        println!("{:?} -> {:?}", span.start, span.stop);
    }
    s.spans.clear(); // Reset the stopwatch.
    println!("{}", s); // Prints the total time.
    println!("{:?}", s); // Prints the different time spans as debug information.
}

Maintainer Information

  • Maintainer: Jojolepro
  • Contact: jojolepro [at] jojolepro [dot] com
  • Website: jojolepro.com
  • Patreon: patreon