Struct web_instant::Spot
source · 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.
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 PartialEq<Spot> for Spot
impl PartialEq<Spot> for Spot
source§impl PartialOrd<Spot> for Spot
impl PartialOrd<Spot> for Spot
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§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