Crates.io | human_readable_duration |
lib.rs | human_readable_duration |
version | 0.1.3 |
source | src |
created_at | 2024-10-29 11:01:19.184465 |
updated_at | 2024-11-21 01:19:13.749466 |
description | A Rust library for formatting and parsing human-readable durations. |
homepage | |
repository | |
max_upload_size | |
id | 1426922 |
size | 3,381 |
Add human_readable_duration to your Cargo.toml dependencies:
[dependencies] human_readable_duration = "0.1.0"
The following example demonstrates how to use the format_duration function with the Duration type:
use human_readable_duration::format_duration;
use std::time::Duration;
fn main() {
let duration = Duration::new(93784, 0); // 1 day, 2 hours, 3 minutes, 4 seconds
println!("{}", format_duration(duration));
// Outputs: "1 day, 2 hours, 3 minutes, 4 seconds"
}
This project is licensed under the MIT License. See the LICENSE file for details.
bensatlantik