Struct embassy_time::Instant
source · [−]pub struct Instant { /* private fields */ }
Expand description
An Instant in time, based on the MCU’s clock ticks since startup.
Implementations
sourceimpl Instant
impl Instant
sourcepub const MIN: Instant = _
pub const MIN: Instant = _
The smallest (earliest) value that can be represented by the Instant
type.
sourcepub const MAX: Instant = _
pub const MAX: Instant = _
The largest (latest) value that can be represented by the Instant
type.
sourcepub const fn from_ticks(ticks: u64) -> Self
pub const fn from_ticks(ticks: u64) -> Self
Create an Instant from a tick count since system boot.
sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Create an Instant from a microsecond count since system boot.
sourcepub const fn from_millis(millis: u64) -> Self
pub const fn from_millis(millis: u64) -> Self
Create an Instant from a millisecond count since system boot.
sourcepub const fn from_secs(seconds: u64) -> Self
pub const fn from_secs(seconds: u64) -> Self
Create an Instant from a second count since system boot.
sourcepub fn duration_since(&self, earlier: Instant) -> Duration
pub fn duration_since(&self, earlier: Instant) -> Duration
Duration between this Instant and another Instant Panics on over/underflow.
sourcepub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration>
pub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration>
Duration between this Instant and another Instant
sourcepub fn saturating_duration_since(&self, earlier: Instant) -> Duration
pub fn saturating_duration_since(&self, earlier: Instant) -> Duration
Returns the duration since the “earlier” Instant. If the “earlier” instant is in the future, the duration is set to zero.
sourcepub fn checked_add(&self, duration: Duration) -> Option<Instant>
pub fn checked_add(&self, duration: Duration) -> Option<Instant>
Adds one Duration to self, returning a new Instant
or None in the event of an overflow.
sourcepub fn checked_sub(&self, duration: Duration) -> Option<Instant>
pub fn checked_sub(&self, duration: Duration) -> Option<Instant>
Subtracts one Duration to self, returning a new Instant
or None in the event of an overflow.
Trait Implementations
sourceimpl 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 Ord for Instant
impl Ord for Instant
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<Instant> for Instant
impl PartialOrd<Instant> for Instant
sourcefn partial_cmp(&self, other: &Instant) -> Option<Ordering>
fn partial_cmp(&self, other: &Instant) -> 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 Instant
impl SubAssign<Duration> for Instant
sourcefn sub_assign(&mut self, other: Duration)
fn sub_assign(&mut self, other: Duration)
-=
operation. Read more