| Crates.io | time-dilation |
| lib.rs | time-dilation |
| version | 0.1.11 |
| created_at | 2025-03-28 09:52:23.551227+00 |
| updated_at | 2025-06-26 07:25:00.154269+00 |
| description | Scoped timers that print execution-time summaries on drop |
| homepage | |
| repository | https://github.com/piot/time-dilation |
| max_upload_size | |
| id | 1609462 |
| size | 6,127 |
A minimal, scoped timing utility for Rust.
time-dilation provides a simple ScopedTimer struct that starts measuring time when it's created and stops when it goes out of scope (is dropped).
It leverages the RAII (Resource Acquisition Is Initialization) pattern: the timer resource is acquired on creation, and measurement implicitly ends when the resource is released (on drop).
Optionally, when the enable_summary feature is activated, the timer will automatically print a human-readable, color-coded summary of the elapsed time to the console when it is dropped.
ScopedTimer::new("description").enable_summary feature to automatically print elapsed time on drop..elapsed().Add this to your Cargo.toml:
[dependencies]
time-dilation = "0.1.10"