Extensions

Trait Extensions 

Source
pub trait Extensions: TimeInt {
    // Provided 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> { ... }
}
Expand description

Create duration-based extensions from primitive numeric types.

use embedded_time::duration::*;

assert_eq!(5.nanoseconds(), Nanoseconds(5_u32));
assert_eq!(5.microseconds(), Microseconds(5_u32));
assert_eq!(5.milliseconds(), Milliseconds(5_u32));
assert_eq!(5.seconds(), Seconds(5_u32));
assert_eq!(5.minutes(), Minutes(5_u32));
assert_eq!(5.hours(), Hours(5_u32));

Provided Methods§

Source

fn nanoseconds(self) -> Nanoseconds<Self>

nanoseconds

Source

fn microseconds(self) -> Microseconds<Self>

microseconds

Source

fn milliseconds(self) -> Milliseconds<Self>

milliseconds

Source

fn seconds(self) -> Seconds<Self>

seconds

Source

fn minutes(self) -> Minutes<Self>

minutes

Source

fn hours(self) -> Hours<Self>

hours

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Extensions for u32

Implementors§