pub struct Instant(/* private fields */);Available on crate feature
embassy only.Expand description
A measurement of a monotonically nondecreasing clock, backed by embassy_time::Instant.
Sub-microsecond precision is truncated when converting to and from core::time::Duration.
Implementations§
Source§impl Instant
impl Instant
Sourcepub const fn into_embassy(self) -> Instant
pub const fn into_embassy(self) -> Instant
Returns the underlying embassy_time::Instant.
Trait Implementations§
Source§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreimpl Copy for Instant
impl Eq for Instant
Source§impl From<Instant> for Instant
impl From<Instant> for Instant
Source§fn from(value: StdInstant) -> Self
fn from(value: StdInstant) -> Self
Converts to this type from the input type.
Source§impl From<Instant> for StdInstant
impl From<Instant> for StdInstant
Source§impl Instant for Instant
impl Instant for Instant
Source§fn now() -> Self
fn now() -> Self
Available on crate features
std and time only.Returns an instant corresponding to “now”.
Source§fn elapsed(&self) -> Duration
fn elapsed(&self) -> Duration
Available on crate features
std and time only.Returns the amount of time elapsed since this instant.
Source§fn checked_add(&self, duration: Duration) -> Option<Self>
fn checked_add(&self, duration: Duration) -> Option<Self>
Available on crate features
std and time only.Returns
Some(t) where t is the time self + duration if t can be represented as
Instant (which means it’s inside the bounds of the underlying data structure), None
otherwise.Source§fn checked_sub(&self, duration: Duration) -> Option<Self>
fn checked_sub(&self, duration: Duration) -> Option<Self>
Available on crate features
std and time only.Returns
Some(t) where t is the time self - duration if t can be represented as
Instant (which means it’s inside the bounds of the underlying data structure), None
otherwise.Source§fn checked_duration_since(&self, earlier: Self) -> Option<Duration>
fn checked_duration_since(&self, earlier: Self) -> Option<Duration>
Available on crate features
std and time only.Returns the amount of time elapsed from another instant to this one,
or None if that instant is later than this one.
Source§fn duration_since(&self, earlier: Self) -> Duration
fn duration_since(&self, earlier: Self) -> Duration
Available on crate features
std and time only.Returns the amount of time elapsed from another instant to this one,
or zero duration if that instant is later than this one.
Source§fn saturating_duration_since(&self, earlier: Self) -> Duration
fn saturating_duration_since(&self, earlier: Self) -> Duration
Available on crate features
std and time only.Returns the amount of time elapsed from another instant to this one,
or zero duration if that instant is later than this one.
Source§impl Ord for Instant
impl Ord for Instant
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Instant
impl PartialOrd for Instant
impl StructuralPartialEq for Instant
Auto Trait Implementations§
impl Freeze for Instant
impl RefUnwindSafe for Instant
impl Send for Instant
impl Sync for Instant
impl Unpin for Instant
impl UnsafeUnpin for Instant
impl UnwindSafe for Instant
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more