Crates.io | duration_helper |
lib.rs | duration_helper |
version | 0.1.0 |
source | src |
created_at | 2023-08-14 08:37:38.049421 |
updated_at | 2023-08-14 08:37:38.049421 |
description | Simple std::time::Duration extension methods for i64 and f64 types: 5.hours() |
homepage | |
repository | |
max_upload_size | |
id | 943959 |
size | 6,349 |
A tiny Rust utility to provide a more concise way to define std::time::Duration
use duration_helper::DurationHelper;
let half_a_second = 0.5.secs();
let five_hours = 5.hours();
let day_and_a_half = 1.5.days();
Nanoseconds: nanos()
Microseconds: micros()
Milliseconds: millis()
Seconds: secs()
Hours: hours()
Days: days()
Weeks: weeks()
Months (approximated as 30 days): months()
Years (approximated as 365 days): years()