Struct coarsetime::Duration
source · [−]pub struct Duration(_);
Expand description
A duration type to represent an approximate span of time
Implementations
sourceimpl 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
sourceimpl AddAssign<Duration> for Duration
impl AddAssign<Duration> for Duration
sourcefn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the +=
operation. Read more
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 DivAssign<u32> for Duration
impl DivAssign<u32> for Duration
sourcefn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
Performs the /=
operation. Read more
sourceimpl MulAssign<u32> for Duration
impl MulAssign<u32> for Duration
sourcefn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
Performs the *=
operation. Read more
sourceimpl Ord for Duration
impl Ord for Duration
sourceimpl PartialOrd<Duration> for Duration
impl PartialOrd<Duration> for Duration
sourcefn partial_cmp(&self, other: &Duration) -> Option<Ordering>
fn partial_cmp(&self, other: &Duration) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn 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.0 · sourcefn 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 Duration
impl SubAssign<Duration> for Duration
sourcefn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
Performs the -=
operation. 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 Duration
impl Eq for Duration
impl StructuralEq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<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.
sourcefn 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