pub struct Spot { /* private fields */ }Implementations§
Source§impl Spot
impl Spot
pub fn now() -> Self
Sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Returns the amount of time elapsed since this instant was created.
Sourcepub fn duration_since(&self, earlier: Spot) -> Duration
pub fn duration_since(&self, earlier: Spot) -> Duration
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
Sourcepub fn checked_duration_since(&self, earlier: Spot) -> Option<Duration>
pub fn checked_duration_since(&self, earlier: Spot) -> Option<Duration>
Returns the amount of time elapsed from another instant to this one, or None if that instant is later than this one.
Due to [monotonicity bugs], even under correct logical ordering of the passed Instants,
this method can return None.
Sourcepub fn saturating_duration_since(&self, earlier: Spot) -> Duration
pub fn saturating_duration_since(&self, earlier: Spot) -> Duration
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
Sourcepub fn checked_add(&self, duration: Duration) -> Option<Spot>
pub fn checked_add(&self, duration: Duration) -> Option<Spot>
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.
Sourcepub fn checked_sub(&self, duration: Duration) -> Option<Spot>
pub fn checked_sub(&self, duration: Duration) -> Option<Spot>
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.
Sourcepub fn duration_since_epoch(&self) -> Duration
pub fn duration_since_epoch(&self) -> Duration
Converts this Spot into a duration that represents the time that has elapsed between the
UNIX Epoch and this Spot
Trait Implementations§
Source§impl AddAssign<Duration> for Spot
impl AddAssign<Duration> for Spot
Source§fn add_assign(&mut self, other: Duration)
fn add_assign(&mut self, other: Duration)
+= operation. Read moreSource§impl PartialOrd for Spot
impl PartialOrd for Spot
Source§impl SubAssign<Duration> for Spot
impl SubAssign<Duration> for Spot
Source§fn sub_assign(&mut self, other: Duration)
fn sub_assign(&mut self, other: Duration)
-= operation. Read more