Skip to main content

Instant

Struct Instant 

Source
pub struct Instant<'a, R: Rate>(/* private fields */);
Expand description

A point in the tick count.

Comparable and subtractable, and bounded to the Timer it came from: a count that stopped and started again would leave it meaning nothing.

Implementations§

Source§

impl<R: Rate> Instant<'_, R>

Source

pub fn elapsed(self) -> Duration<R>

How long since this was taken.

Source

pub fn saturating_duration_since(self, earlier: Self) -> Duration<R>

How long from earlier to this.

Zero if earlier is the later of the two.

Source

pub fn checked_duration_since(self, earlier: Self) -> Option<Duration<R>>

How long from earlier to this, or None if earlier is the later.

Trait Implementations§

Source§

impl<'a, R: Rate> Add<Duration<R>> for Instant<'a, R>

Source§

type Output = Instant<'a, R>

The resulting type after applying the + operator.
Source§

fn add(self, span: Duration<R>) -> Self

Performs the + operation. Read more
Source§

impl<R: Rate> Clone for Instant<'_, R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Rate> Copy for Instant<'_, R>

Source§

impl<R: Rate> Eq for Instant<'_, R>

Source§

impl<R: Rate> Ord for Instant<'_, R>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<R: Rate> PartialEq for Instant<'_, R>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<R: Rate> PartialOrd for Instant<'_, R>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<R: Rate> Sub for Instant<'_, R>

Source§

fn sub(self, earlier: Self) -> Duration<R>

How long from earlier to this, wrapping if they are the wrong way round.

Source§

type Output = Duration<R>

The resulting type after applying the - operator.
Source§

impl<'a, R: Rate> Sub<Duration<R>> for Instant<'a, R>

Source§

type Output = Instant<'a, R>

The resulting type after applying the - operator.
Source§

fn sub(self, span: Duration<R>) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<'a, R> !Send for Instant<'a, R>

§

impl<'a, R> !Sync for Instant<'a, R>

§

impl<'a, R> BankSafe for Instant<'a, R>
where R: BankSafe,

§

impl<'a, R> Freeze for Instant<'a, R>

§

impl<'a, R> RefUnwindSafe for Instant<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Unpin for Instant<'a, R>

§

impl<'a, R> UnsafeUnpin for Instant<'a, R>

§

impl<'a, R> UnwindSafe for Instant<'a, R>
where R: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CellValue for T
where T: Copy + BankSafe,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.