pub struct Duration(/* private fields */);Expand description
A Duration type to represent a span of time, typically used for system timeouts.
This type wraps std::time::Duration so we can implement traits on it
without coherence issues, just like if we were implementing this in the
stdlib.
Implementations§
Source§impl Duration
impl Duration
Sourcepub fn new(secs: u64, nanos: u32) -> Duration
pub fn new(secs: u64, nanos: u32) -> Duration
Creates a new Duration from the specified number of whole seconds and
additional nanoseconds.
Sourcepub fn from_secs(secs: u64) -> Duration
pub fn from_secs(secs: u64) -> Duration
Creates a new Duration from the specified number of whole 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 from_micros(micros: u64) -> Duration
pub fn from_micros(micros: u64) -> Duration
Creates a new Duration from the specified number of microseconds.
Sourcepub fn from_nanos(nanos: u64) -> Duration
pub fn from_nanos(nanos: u64) -> Duration
Creates a new Duration from the specified number of nanoseconds.
Sourcepub fn from_secs_f64(secs: f64) -> Duration
pub fn from_secs_f64(secs: f64) -> Duration
Sourcepub fn from_secs_f32(secs: f32) -> Duration
pub fn from_secs_f32(secs: f32) -> Duration
Creates a new Duration from the specified number of seconds represented
as f32.
§Panics
This constructor will panic if secs is not finite, negative or overflows Duration.
Sourcepub const fn as_secs(&self) -> u64
pub const fn as_secs(&self) -> u64
Returns the number of whole seconds contained by this Duration.
Sourcepub const fn as_millis(&self) -> u128
pub const fn as_millis(&self) -> u128
Returns the number of whole milliseconds contained by this Duration.
Trait Implementations§
Source§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 IntoFuture for Duration
impl IntoFuture for Duration
Source§type IntoFuture = Wait
type IntoFuture = Wait
Source§fn into_future(self) -> <Duration as IntoFuture>::IntoFuture
fn into_future(self) -> <Duration as IntoFuture>::IntoFuture
Source§impl Ord for Duration
impl Ord for Duration
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
Source§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 UnsafeUnpin 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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.