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.

The resulting type after applying the + operator.

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests greater than or equal to (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.

The resulting type after applying the - operator.

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.