| Crates.io | timelog |
| lib.rs | timelog |
| version | 1.0.7 |
| created_at | 2024-10-18 05:37:32.584185+00 |
| updated_at | 2025-01-19 17:01:50.940933+00 |
| description | A simple timer for logging time durations like console.time in JavaScript. |
| homepage | |
| repository | https://github.com/zhangyuang/timelog |
| max_upload_size | |
| id | 1413902 |
| size | 11,372 |
A simple timer library for logging time durations, similar to console.time in JavaScript.
Add the following line to your Cargo.toml file:
[dependencies]
timelog = "1.0.0"
use timelog::Timer;
fn main() {
let mut timer = Timer::new();
timer.time("fetch_data");
let duration: f64 = timer.time_log("fetch_data", true);
println!("fetch_data took {:.2}ms", duration);
}