Struct concordium_contracts_common::Duration [−][src]
#[repr(transparent)]pub struct Duration { /* fields omitted */ }
Expand description
Duration of time in milliseconds.
Negative durations are not allowed.
Implementations
impl Duration
[src]
impl Duration
[src]pub fn from_millis(milliseconds: u64) -> Self
[src]
pub fn from_millis(milliseconds: u64) -> Self
[src]Construct duration from milliseconds.
pub fn from_seconds(seconds: u64) -> Self
[src]
pub fn from_seconds(seconds: u64) -> Self
[src]Construct duration from seconds.
pub fn from_minutes(minutes: u64) -> Self
[src]
pub fn from_minutes(minutes: u64) -> Self
[src]Construct duration from minutes.
pub fn from_hours(hours: u64) -> Self
[src]
pub fn from_hours(hours: u64) -> Self
[src]Construct duration from hours.
pub fn checked_add(self, other: Duration) -> Option<Self>
[src]
pub fn checked_add(self, other: Duration) -> Option<Self>
[src]Add duration. Returns None
instead of overflowing.
pub fn checked_sub(self, other: Duration) -> Option<Self>
[src]
pub fn checked_sub(self, other: Duration) -> Option<Self>
[src]Subtract duration. Returns None
instead of overflowing.
Trait Implementations
impl FromStr for Duration
[src]
impl FromStr for Duration
[src]Parse a string containing a list of duration measures separated by whitespaces. A measure is a number followed by the unit (no whitespace between is allowed). Every measure is accumulated into a duration. The string is allowed to contain any number of measures with the same unit in no particular order.
The supported units are:
ms
for millisecondss
for secondsm
for minutesh
for hoursd
for days
Example
The duration of 10 days, 1 hour, 2minutes and 7 seconds is:
"10d 1h 2m 3s 4s"
impl Ord for Duration
[src]
impl Ord for Duration
[src]impl PartialOrd<Duration> for Duration
[src]
impl PartialOrd<Duration> for Duration
[src]fn partial_cmp(&self, other: &Duration) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Duration) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Duration
[src]
impl Eq for Duration
[src]
impl StructuralEq for Duration
[src]
impl StructuralPartialEq for Duration
[src]
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
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more