num-time-duration 0.1.0

Provide a convenient way to create `std::time::Duration` from numbers.
Documentation
  • Coverage
  • 90%
    9 out of 10 items documented9 out of 10 items with examples
  • Size
  • Source code size: 5.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.21 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ya7010/num-time-duration
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • y7010

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"