Trait NumericalDuration
pub trait NumericalDuration: Sealed
Create SignedDurations from numeric literals.
Examples
Basic construction of SignedDurations.
# use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Signed integers work as well!
# use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Just like any other SignedDuration, they can be added, subtracted, etc.
# use NumericalDuration;
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 nanoseconds(self) -> SignedDurationCreate a
SignedDurationfrom the number of nanoseconds.fn microseconds(self) -> SignedDurationCreate a
SignedDurationfrom the number of microseconds.fn milliseconds(self) -> SignedDurationCreate a
SignedDurationfrom the number of milliseconds.fn seconds(self) -> SignedDurationCreate a
SignedDurationfrom the number of seconds.fn minutes(self) -> SignedDurationCreate a
SignedDurationfrom the number of minutes.fn hours(self) -> SignedDurationCreate a
SignedDurationfrom the number of hours.fn days(self) -> SignedDurationCreate a
SignedDurationfrom the number of days.fn weeks(self) -> SignedDurationCreate a
SignedDurationfrom the number of weeks.
Implementors
impl NumericalDuration for f64impl NumericalDuration for i64