num-time-duration

Crates.ionum-time-duration
lib.rsnum-time-duration
version0.1.0
sourcesrc
created_at2021-07-12 01:27:26.29576
updated_at2021-07-12 01:27:26.29576
descriptionProvide a convenient way to create `std::time::Duration` from numbers.
homepage
repositoryhttps://github.com/yassun4dev/num-time-duration.git
max_upload_size
id421697
size5,570
yassun7010 (yassun7010)

documentation

README

num-time-duration

This crate provides a convenient way to create std::time::Duration from numbers.

Example:

use num_time_duration::NumTimeDuration;

let now = std::time::SystemTime::now();
assert_eq!(now + 1.hours(), now + std::time::Duration::from_secs(3600));
assert_eq!(now + 1.days(), now + std::time::Duration::from_secs(86400));
assert_eq!(now - 1.weeks(), now - std::time::Duration::from_secs(604800));

Usage

To use num-time-duration, add this to your Cargo.toml:

[dependencies]
num-time-duration = "0.1.0"
Commit count: 1

cargo fmt