Struct Instant
pub struct Instant { /* private fields */ }Expand description
An Instant in time, based on the MCU’s clock ticks since startup.
Implementations§
§impl Instant
impl Instant
pub const fn from_ticks(ticks: u64) -> Instant
pub const fn from_ticks(ticks: u64) -> Instant
Create an Instant from a tick count since system boot.
pub const fn from_micros(micros: u64) -> Instant
pub const fn from_micros(micros: u64) -> Instant
Create an Instant from a microsecond count since system boot.
pub const fn from_millis(millis: u64) -> Instant
pub const fn from_millis(millis: u64) -> Instant
Create an Instant from a millisecond count since system boot.
pub const fn from_secs(seconds: u64) -> Instant
pub const fn from_secs(seconds: u64) -> Instant
Create an Instant from a second count since system boot.
pub 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.
pub 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
pub 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.
pub 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.
pub 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§
§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
§fn add_assign(&mut self, other: Duration)
fn add_assign(&mut self, other: Duration)
Performs the
+= operation. Read more§impl Ord for Instant
impl Ord for Instant
§impl PartialOrd for Instant
impl PartialOrd for Instant
§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
§fn sub_assign(&mut self, other: Duration)
fn sub_assign(&mut self, other: Duration)
Performs the
-= operation. Read moreimpl Copy for Instant
impl Eq 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 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