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§
§impl Instant
impl Instant
pub const ZERO: Instant = _
pub fn from_micros<T>(micros: T) -> Instantwhere
T: Into<i64>,
pub fn from_micros<T>(micros: T) -> Instantwhere T: Into<i64>,
Create a new Instant
from a number of microseconds.
pub const fn from_micros_const(micros: i64) -> Instant
pub fn from_millis<T>(millis: T) -> Instantwhere
T: Into<i64>,
pub fn from_millis<T>(millis: T) -> Instantwhere T: Into<i64>,
Create a new Instant
from a number of milliseconds.
pub 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.
pub fn from_secs<T>(secs: T) -> Instantwhere
T: Into<i64>,
pub fn from_secs<T>(secs: T) -> Instantwhere T: Into<i64>,
Create a new Instant
from a number of seconds.
pub const fn millis(&self) -> i64
pub const fn millis(&self) -> i64
The fractional number of milliseconds that have passed since the beginning of time.
pub const fn micros(&self) -> i64
pub const fn micros(&self) -> i64
The fractional number of microseconds that have passed since the beginning of time.
pub const fn secs(&self) -> i64
pub const fn secs(&self) -> i64
The number of whole seconds that have passed since the beginning of time.
pub 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.
pub 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§
§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+=
operation. Read more§impl Ord for Instant
impl Ord for Instant
§impl PartialOrd<Instant> for Instant
impl PartialOrd<Instant> for Instant
§fn partial_cmp(&self, other: &Instant) -> Option<Ordering>
fn partial_cmp(&self, other: &Instant) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read more