[−][src]Trait embedded_time::TimeRep
Create Duration
s from primitive and core numeric types.
This trait can be imported with use embedded-time::prelude::*
.
Examples
Basic construction of Duration
s.
assert_eq!(5.nanoseconds(), Nanoseconds(5)); assert_eq!(5.microseconds(), Microseconds(5)); assert_eq!(5.milliseconds(), Milliseconds(5)); assert_eq!(5.seconds(), Seconds(5)); assert_eq!(5.minutes(), Minutes(5)); assert_eq!(5.hours(), Hours(5));
Signed integers work as well!
assert_eq!((-5).nanoseconds(), Nanoseconds(-5)); assert_eq!((-5).microseconds(), Microseconds(-5)); assert_eq!((-5).milliseconds(), Milliseconds(-5)); assert_eq!((-5).seconds(), Seconds(-5)); assert_eq!((-5).minutes(), Minutes(-5)); assert_eq!((-5).hours(), Hours(-5));
Required methods
fn nanoseconds(self) -> Nanoseconds<Self>
fn microseconds(self) -> Microseconds<Self>
fn milliseconds(self) -> Milliseconds<Self>
fn seconds(self) -> Seconds<Self>
fn minutes(self) -> Minutes<Self>
fn hours(self) -> Hours<Self>
Provided methods
fn checked_mul(&self, ratio: &Period) -> Option<Self>
fn checked_div(&self, ratio: &Period) -> Option<Self>
Implementors
impl TimeRep for i32
[src]
Create a duration from a primitive integer type
fn nanoseconds(self) -> Nanoseconds<i32>
[src]
fn microseconds(self) -> Microseconds<i32>
[src]
fn milliseconds(self) -> Milliseconds<i32>
[src]
fn seconds(self) -> Seconds<i32>
[src]
fn minutes(self) -> Minutes<i32>
[src]
fn hours(self) -> Hours<i32>
[src]
impl TimeRep for i64
[src]
Create a duration from a primitive integer type