Struct pausable_clock::PausableInstant [−][src]
pub struct PausableInstant { /* fields omitted */ }
Expand description
Native representation of a paused instant that contains the reference time and the elapsed time on the clock from the reference time.
Note on PartialOrd/Ord
The derived Ord and PartialOrd behavior is only valid for PausableInstants from the same clock. While the compare functions from ord and partial_ord can be called on PausableInstants from different clocks without panics, the results will have no guaranteed order
Implementations
Get this pausable instant’s elapsed millis.
Get the instant this pausable instant is referenced off of
Get the elapsed time since this instant according to the given (and ideally originating) clock.
#Panics
This function will panic If the given clock produces a now()
instant
that is “before” this one. This is guaranteed not to happen if the
given clock is the originating clock
Returns the amount of time elapsed from another instant to this one according to the pausable clock. Ideally the given instant is from the same pausable clock otherwise the resulting duration is meaningless.
#Panics
This function will panic if the given instant is “later” than this one.
Returns the amount of time elapsed from another instant to this one according to the pausable clock. Ideally the given instant is from the same pausable clock otherwise the resulting duration is meaningless.
This function will return None if the given instant is “later” than this one.
Returns the amount of time elapsed from another instant to this one according to the pausable clock. Ideally the given instant is from the same pausable clock otherwise the resulting duration is meaningless.
This function will return zero if the given instant is “later” than this one.
Returns Some(t)
where t
is the time self + duration
if the given
duration can be represented in milliseconds as a u64 and this
pausable instant’s elapsed milliseconds plus the duration in millis can
also be represented as a u64.
Effectively this means the resulting duration since the elapse millis needs to be less than about 500 million years.
Returns Some(t)
where t
is the time self - duration
if the given
duration can be represented in milliseconds as a u64, and this
pausable instant’s elapsed milliseconds >= the duration in milliseconds
Effectively this means the given duration needs to be less than about 500 million years, and the resulting instant cannot be before the zero instant of this pausable instant.
Trait Implementations
#Panics
This function may panic if the resulting point in time cannot be
represented by the underlying data structure. See
PausableInstant::checked_add
for a version without panic.
type Output = PausableInstant
type Output = PausableInstant
The resulting type after applying the +
operator.
Performs the +=
operation. Read more
Convert from the given pausable instant to a std instant. This is
helpful for working with other libraries that need time info, but it has
minor risks because once converted to a std instant, functions like
elapsed()
and duration_since()
will produce unexpected results
because those functions compare against the actual time and not the
pausable time.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#Panics
This function may panic if the resulting point in time cannot be
represented by the underlying data structure. See
PausableInstant::checked_sub
for a version without panic.
type Output = PausableInstant
type Output = PausableInstant
The resulting type after applying the -
operator.
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for PausableInstant
impl Send for PausableInstant
impl Sync for PausableInstant
impl Unpin for PausableInstant
impl UnwindSafe for PausableInstant
Blanket Implementations
Mutably borrows from an owned value. Read more