Trait NumericalStdDuration
trait NumericalStdDuration: sealed::Sealed
Create std::time::Durations from numeric literals.
Examples
Basic construction of std::time::Durations.
# use NumericalStdDuration;
# use Duration;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Just like any other std::time::Duration, they can be added, subtracted, etc.
# use NumericalStdDuration;
assert_eq!;
assert_eq!;
When called on floating point values, any remainder of the floating point value will be truncated. Keep in mind that floating point numbers are inherently imprecise and have limited capacity.
Required Methods
fn std_nanoseconds(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of nanoseconds.fn std_microseconds(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of microseconds.fn std_milliseconds(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of milliseconds.fn std_seconds(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of seconds.fn std_minutes(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of minutes.fn std_hours(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of hours.fn std_days(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of days.fn std_weeks(self: Self) -> StdDurationCreate a
std::time::Durationfrom the number of weeks.
Implementors
impl NumericalStdDuration for u64impl NumericalStdDuration for f64