6 releases
new 0.1.5 | Jan 30, 2025 |
---|---|
0.1.4 | Jan 30, 2025 |
#1580 in Command line utilities
154 downloads per month
15KB
214 lines
Execution Time
This Rust project provides a simple way to measure and display the execution time of code blocks. It allows you to start a timer and then print the elapsed time in a human-readable format, including days, hours, minutes, and seconds.
Usage
-
Add the dependency to your
Cargo.toml
file:[dependencies] execution-time = "0.1"
-
Import and Use the library in your main.rs file.
use execution_time::ExecutionTime; fn main() { let timer = ExecutionTime::start(); // Simulate some work being done std::thread::sleep(std::time::Duration::from_millis(1234)); // println!("Elapsed time: {}", timer.get_elapsed_time()); timer.print_elapsed_time(); }