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 microseconds, monotonically increasing
since an arbitrary moment in time, such as system startup.
- A value of
0
is inherently arbitrary. - A value less than
0
indicates a time before the starting point.
Implementations§
Source§impl Instant
impl Instant
pub const ZERO: 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§
Source§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+=
operation. Read moreSource§impl Ord for Instant
impl Ord for Instant
Source§impl PartialOrd for Instant
impl PartialOrd for Instant
Source§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read more