Stopwatch, a Rust Crate
- 2024-01-15
- 22:02
I made a stopwatch crate for Rust. This exists because I added an existing stopwatch crate to a project and my cargo.lock
had a bunch of unnecessary new entries due to dependencies so I wrote one in pure Rust.
I will not be posting it on crates.io for several reasons:
- Name collision with stopwatch
- Supply chain attacks are a thing and people need to stop relying on centralised distribution
- Git is always up-to-date, and you can choose a version from a commit hash
Usage is simple
let mut stopwatch = Stopwatch::new();
stopwatch.start();
// Do a long running task
std::thread::sleep(Duration::from_secs(5));
stopwatch.stop();
println!("Operation complete in: {}", stopwatch);
Source and complete instructions are available in the git repository
Surprisingly enough (even to me), the license is CC0.
Email me with any bugs. :)