pub struct CoarseDuration(_);
Expand description
A duration type to represent an approximate span of time
Implementations§
source§impl Duration
impl Duration
sourcepub fn new(sec: u64, nanos: u32) -> Duration
pub fn new(sec: u64, nanos: u32) -> Duration
Creates a new Duration
from the specified number of seconds and additional nanosecond
precision
sourcepub fn from_days(days: u64) -> Duration
pub fn from_days(days: u64) -> Duration
Creates a new Duration from the specified number of days
sourcepub fn from_hours(hours: u64) -> Duration
pub fn from_hours(hours: u64) -> Duration
Creates a new Duration from the specified number of hours
sourcepub fn from_mins(mins: u64) -> Duration
pub fn from_mins(mins: u64) -> Duration
Creates a new Duration from the specified number of minutes
sourcepub fn from_secs(secs: u64) -> Duration
pub fn from_secs(secs: u64) -> Duration
Creates a new Duration from the specified number of seconds
sourcepub fn from_millis(millis: u64) -> Duration
pub fn from_millis(millis: u64) -> Duration
Creates a new Duration from the specified number of milliseconds
sourcepub fn as_millis(&self) -> u64
pub fn as_millis(&self) -> u64
Returns the number of whole milliseconds represented by this duration
sourcepub fn as_micros(&self) -> u64
pub fn as_micros(&self) -> u64
Returns the number of whole microseconds represented by this duration
sourcepub fn as_nanos(&self) -> u64
pub fn as_nanos(&self) -> u64
Returns the number of whole nanoseconds represented by this duration
sourcepub fn subsec_nanos(&self) -> u32
pub fn subsec_nanos(&self) -> u32
Returns the nanosecond precision represented by this duration
sourcepub fn as_ticks(&self) -> u64
pub fn as_ticks(&self) -> u64
Return this duration as a number of “ticks”.
Note that length of a ‘tick’ is not guaranteed to represent
the same amount of time across different platforms, or from
one version of coarsetime
to another.
sourcepub fn from_ticks(ticks: u64) -> Duration
pub fn from_ticks(ticks: u64) -> Duration
Creates a new Duration from the specified number of “ticks”.
Note that length of a ‘tick’ is not guaranteed to represent
the same amount of time across different platforms, or from
one version of coarsetime
to another.
Trait Implementations§
source§impl AddAssign<Duration> for Duration
impl AddAssign<Duration> for Duration
source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+=
operation. Read moresource§impl DivAssign<u32> for Duration
impl DivAssign<u32> for Duration
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/=
operation. Read moresource§impl MulAssign<u32> for Duration
impl MulAssign<u32> for Duration
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moresource§impl Ord for Duration
impl Ord for Duration
source§impl PartialEq<Duration> for Duration
impl PartialEq<Duration> for Duration
source§impl PartialOrd<Duration> for Duration
impl PartialOrd<Duration> for Duration
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 moresource§impl SubAssign<Duration> for Duration
impl SubAssign<Duration> for Duration
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read more