Struct coarsetime::Duration
source · pub struct Duration(/* private fields */);
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 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 AddAssign for Duration
impl AddAssign 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 for Duration
impl PartialEq for Duration
source§impl PartialOrd for Duration
impl PartialOrd 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 Instant
impl SubAssign<Duration> for Instant
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read moresource§impl SubAssign for Duration
impl SubAssign for Duration
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read moreimpl Copy for Duration
impl Eq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)