Struct rubble::time::Instant[][src]

pub struct Instant(_);
Expand description

A point in time, relative to an unspecfied epoch.

This has microsecond resolution and may wrap around after >1 hour. Apart from the wraparound, it is monotonic.

Instants are obtained from an implementation of Timer. Instants created from different Timer instances (even when using the same implementation) are not compatible, and mixing them in operations causes unspecified results. Durations are independent of the Timer implementation and thus can be mixed freely.

Implementations

The maximum time between two Instants that can be handled by Instant::duration_since.

This is defined to be a value of a few minutes, intended to be sufficient for the BLE stack.

Creates an Instant from raw microseconds since an arbitrary implementation-defined reference point.

This should only be called from a Timer implementation.

Returns the raw value from which this Instant was created.

This should only be called from a Timer implementation.

Calculates the duration of time that has passed between earlier and self.

The maximum duration that can be calculated by this method is defined as MAX_TIME_BETWEEN. Calling this method when the Instants are further apart is an error and may panic. This is done as a safeguard, since Instants can wrap around, which can cause the result of this function to be incorrect. It does not prevent that from happening, but makes unexpected durations show up much earlier.

Both self and earlier must have been created by the same Timer, or the result of this function will be unspecified.

Trait Implementations

A Duration can be added to an Instant, moving the Instant forwards in time.

The resulting type after applying the + operator.

Performs the + operation. Read more

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

Formats the value using the given formatter. Read more

A Duration can be subtracted from an Instant, moving the Instant backwards in time.

The resulting type after applying the - operator.

Performs the - operation. Read more

Instants can be subtracted, which computes the Duration between the rhs and lhs using Instant::duration_since.

The resulting type after applying the - operator.

Performs the - operation. Read more

Subtracts a Duration from self.

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.

Should always be Self

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.