Struct embassy_time::Duration
source · [−]pub struct Duration { /* private fields */ }Expand description
Represents the difference between two Instants
Implementations
sourceimpl Duration
impl Duration
sourcepub const fn from_ticks(ticks: u64) -> Duration
pub const fn from_ticks(ticks: u64) -> Duration
Creates a duration from the specified number of clock ticks
sourcepub const fn from_secs(secs: u64) -> Duration
pub const fn from_secs(secs: u64) -> Duration
Creates a duration from the specified number of seconds, rounding up.
sourcepub const fn from_millis(millis: u64) -> Duration
pub const fn from_millis(millis: u64) -> Duration
Creates a duration from the specified number of milliseconds, rounding up.
sourcepub const fn from_micros(micros: u64) -> Duration
pub const fn from_micros(micros: u64) -> Duration
Creates a duration from the specified number of microseconds, rounding up. NOTE: Delays this small may be inaccurate.
sourcepub const fn from_secs_floor(secs: u64) -> Duration
pub const fn from_secs_floor(secs: u64) -> Duration
Creates a duration from the specified number of seconds, rounding down.
sourcepub const fn from_millis_floor(millis: u64) -> Duration
pub const fn from_millis_floor(millis: u64) -> Duration
Creates a duration from the specified number of milliseconds, rounding down.
sourcepub const fn from_micros_floor(micros: u64) -> Duration
pub const fn from_micros_floor(micros: u64) -> Duration
Creates a duration from the specified number of microseconds, rounding down. NOTE: Delays this small may be inaccurate.
sourcepub fn checked_add(self, rhs: Duration) -> Option<Duration>
pub fn checked_add(self, rhs: Duration) -> Option<Duration>
Adds one Duration to another, returning a new Duration or None in the event of an overflow.
sourcepub fn checked_sub(self, rhs: Duration) -> Option<Duration>
pub fn checked_sub(self, rhs: Duration) -> Option<Duration>
Subtracts one Duration to another, returning a new Duration or None in the event of an overflow.
sourcepub fn checked_mul(self, rhs: u32) -> Option<Duration>
pub fn checked_mul(self, rhs: u32) -> Option<Duration>
Multiplies one Duration by a scalar u32, returning a new Duration or None in the event of an overflow.
sourcepub fn checked_div(self, rhs: u32) -> Option<Duration>
pub fn checked_div(self, rhs: u32) -> Option<Duration>
Divides one Duration a scalar u32, returning a new Duration or None in the event of an overflow.
Trait Implementations
sourceimpl AddAssign<Duration> for Duration
impl AddAssign<Duration> for Duration
sourcefn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read moresourceimpl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
sourcefn add_assign(&mut self, other: Duration)
fn add_assign(&mut self, other: Duration)
+= operation. Read moresourceimpl DivAssign<u32> for Duration
impl DivAssign<u32> for Duration
sourcefn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/= operation. Read moresourceimpl MulAssign<u32> for Duration
impl MulAssign<u32> for Duration
sourcefn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*= operation. Read moresourceimpl Ord for Duration
impl Ord for Duration
1.21.0 · sourceconst fn max(self, other: Self) -> Selfwhere
Self: Sized,
const fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourceconst fn min(self, other: Self) -> Selfwhere
Self: Sized,
const fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialOrd<Duration> for Duration
impl PartialOrd<Duration> for Duration
sourcefn partial_cmp(&self, other: &Duration) -> Option<Ordering>
fn partial_cmp(&self, other: &Duration) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl SubAssign<Duration> for Duration
impl SubAssign<Duration> for Duration
sourcefn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-= operation. Read moresourceimpl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
sourcefn sub_assign(&mut self, other: Duration)
fn sub_assign(&mut self, other: Duration)
-= operation. Read more