pub struct Duration { /* private fields */ }
Implementations§
source§impl Duration
impl Duration
pub const SECOND: Duration = _
pub const MILLISECOND: Duration = _
pub const ZERO: Duration = _
pub const MAX: Duration = _
pub const fn new(secs: u32, millis: u16) -> Duration
pub const fn from_secs(secs: u32) -> Duration
pub const fn from_millis(millis: u32) -> Duration
pub const fn is_zero(&self) -> bool
pub const fn as_secs(&self) -> u32
pub const fn subsec_millis(&self) -> u16
pub const fn as_millis(&self) -> u64
sourcepub const fn checked_add(self, rhs: Duration) -> Option<Duration>
pub const fn checked_add(self, rhs: Duration) -> Option<Duration>
Checked Duration
addition. Computes self + other
, returning None
if overflow occurred.
sourcepub const fn saturating_add(self, rhs: Duration) -> Duration
pub const fn saturating_add(self, rhs: Duration) -> Duration
Saturating Duration
addition. Computes self + other
, returning Duration::MAX
if overflow occurred.
sourcepub const fn checked_sub(self, rhs: Duration) -> Option<Duration>
pub const fn checked_sub(self, rhs: Duration) -> Option<Duration>
Checked Duration
subtraction. Computes self - other
, returning None
if the result would be negative or if overflow occurred.
sourcepub const fn saturating_sub(self, rhs: Duration) -> Duration
pub const fn saturating_sub(self, rhs: Duration) -> Duration
Saturating Duration
subtraction. Computes self - other
, returning Duration::ZERO
if the result would be negative or if overflow occurred.
sourcepub const fn checked_mul(self, rhs: u16) -> Option<Duration>
pub const fn checked_mul(self, rhs: u16) -> Option<Duration>
Checked Duration
multiplication. Computes self * other
, returning
None
if overflow occurred.
sourcepub const fn saturating_mul(self, rhs: u16) -> Duration
pub const fn saturating_mul(self, rhs: u16) -> Duration
Saturating Duration
multiplication. Computes self * other
, returning
Duration::MAX
if overflow occurred.
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)
Performs the
+=
operation. Read moresource§impl MulAssign<u16> for Duration
impl MulAssign<u16> for Duration
source§fn mul_assign(&mut self, rhs: u16)
fn mul_assign(&mut self, rhs: u16)
Performs the
*=
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
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Persist for Duration
impl Persist for Duration
source§fn load_from<R: Read>(reader: &mut R) -> PersistenceResult<Self>where
Self: Sized,
fn load_from<R: Read>(reader: &mut R) -> PersistenceResult<Self>where
Self: Sized,
Load an instance of this struct from the given reader
source§fn save_to<W: Write>(&self, writer: &mut W) -> PersistenceResult<()>
fn save_to<W: Write>(&self, writer: &mut W) -> PersistenceResult<()>
Save an instance of this struct to the given writer.
source§fn load_from_or_default<R: Read>(reader: &mut R) -> Selfwhere
Self: Default,
fn load_from_or_default<R: Read>(reader: &mut R) -> Selfwhere
Self: Default,
Load an instance of this type from the given reader, or return the Default
instantiation if it cannot be loaded.
source§fn load_with<R: Read>(reader: R) -> PersistenceResult<Self>
fn load_with<R: Read>(reader: R) -> PersistenceResult<Self>
Take the given reader and use it to load an instance of this type.
source§fn load_with_or_default<R: Read>(reader: R) -> Selfwhere
Self: Default,
fn load_with_or_default<R: Read>(reader: R) -> Selfwhere
Self: Default,
Take the given reader and use it to load an instance of this type,
or return the Default instantiation if it cannot be loaded.
source§impl SubAssign for Duration
impl SubAssign for Duration
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
Performs the
-=
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
Mutably borrows from an owned value. Read more