human_readable_duration

Crates.iohuman_readable_duration
lib.rshuman_readable_duration
version0.1.3
sourcesrc
created_at2024-10-29 11:01:19.184465
updated_at2024-11-21 01:19:13.749466
descriptionA Rust library for formatting and parsing human-readable durations.
homepage
repository
max_upload_size
id1426922
size3,381
Ben Santora (bensatlantik)

documentation

https://docs.rs/human_duration

README

Installation

Add human_readable_duration to your Cargo.toml dependencies:

[dependencies] human_readable_duration = "0.1.0"

Usage

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"
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

bensatlantik

Commit count: 0

cargo fmt