pub struct Instant { /* private fields */ }Expand description
A representation of an absolute time value.
The Instant type is a wrapper around a i64 value that
represents a number of milliseconds, monotonically increasing
since an arbitrary moment in time, such as system startup.
- A value of
0is inherently arbitrary. - A value less than
0indicates a time before the starting point.
Implementations
sourceimpl Instant
impl Instant
sourcepub fn from_micros<T: Into<i64>>(micros: T) -> Instant
pub fn from_micros<T: Into<i64>>(micros: T) -> Instant
Create a new Instant from a number of microseconds.
pub const fn from_micros_const(micros: i64) -> Instant
sourcepub fn from_millis<T: Into<i64>>(millis: T) -> Instant
pub fn from_millis<T: Into<i64>>(millis: T) -> Instant
Create a new Instant from a number of milliseconds.
sourcepub const fn from_millis_const(millis: i64) -> Instant
pub const fn from_millis_const(millis: i64) -> Instant
Create a new Instant from a number of milliseconds.
sourcepub fn from_secs<T: Into<i64>>(secs: T) -> Instant
pub fn from_secs<T: Into<i64>>(secs: T) -> Instant
Create a new Instant from a number of seconds.
sourcepub const fn millis(&self) -> i64
pub const fn millis(&self) -> i64
The fractional number of milliseconds that have passed since the beginning of time.
sourcepub const fn micros(&self) -> i64
pub const fn micros(&self) -> i64
The fractional number of microseconds that have passed since the beginning of time.
sourcepub const fn secs(&self) -> i64
pub const fn secs(&self) -> i64
The number of whole seconds that have passed since the beginning of time.
sourcepub const fn total_millis(&self) -> i64
pub const fn total_millis(&self) -> i64
The total number of milliseconds that have passed since the beginning of time.
sourcepub const fn total_micros(&self) -> i64
pub const fn total_micros(&self) -> i64
The total number of milliseconds that have passed since the beginning of time.
Trait Implementations
sourceimpl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
sourcefn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the += operation. Read more
sourceimpl Ord for Instant
impl Ord for Instant
sourceimpl PartialOrd<Instant> for Instant
impl PartialOrd<Instant> for Instant
sourcefn partial_cmp(&self, other: &Instant) -> Option<Ordering>
fn partial_cmp(&self, other: &Instant) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0fn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
sourcefn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
Performs the -= operation. Read more
impl Copy for Instant
impl Eq for Instant
impl StructuralEq for Instant
impl StructuralPartialEq for Instant
Auto Trait Implementations
impl RefUnwindSafe for Instant
impl Send for Instant
impl Sync for Instant
impl Unpin for Instant
impl UnwindSafe for Instant
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more