[−][src]Struct concordium_contracts_common::Duration
Duration of time in milliseconds.
Negative durations are not allowed.
Implementations
impl Duration
[src]
pub fn from_millis(milliseconds: u64) -> Self
[src]
Construct duration from milliseconds.
pub fn from_seconds(seconds: u64) -> Self
[src]
Construct duration from seconds.
pub fn from_minutes(minutes: u64) -> Self
[src]
Construct duration from minutes.
pub fn from_hours(hours: u64) -> Self
[src]
Construct duration from hours.
pub fn from_days(days: u64) -> Self
[src]
Construct duration from days.
pub fn millis(&self) -> u64
[src]
Get number of milliseconds in the duration.
pub fn seconds(&self) -> u64
[src]
Get number of seconds in the duration.
pub fn minutes(&self) -> u64
[src]
Get number of minutes in the duration.
pub fn hours(&self) -> u64
[src]
Get number of hours in the duration.
pub fn days(&self) -> u64
[src]
Get number of days in the duration.
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]
Subtract duration. Returns None
instead of overflowing.
Trait Implementations
impl Clone for Duration
[src]
impl Copy for Duration
[src]
impl Debug for Duration
[src]
impl Deserial for Duration
[src]
pub fn deserial<R: Read>(source: &mut R) -> ParseResult<Self>
[src]
impl Display for Duration
[src]
impl Eq 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"
type Err = ParseDurationError
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Ord for Duration
[src]
pub fn cmp(&self, other: &Duration) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Duration> for Duration
[src]
impl PartialOrd<Duration> for Duration
[src]
pub fn partial_cmp(&self, other: &Duration) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Duration) -> bool
[src]
pub fn le(&self, other: &Duration) -> bool
[src]
pub fn gt(&self, other: &Duration) -> bool
[src]
pub fn ge(&self, other: &Duration) -> bool
[src]
impl SchemaType for Duration
[src]
impl Serial for Duration
[src]
impl StructuralEq for Duration
[src]
impl StructuralPartialEq for Duration
[src]
Auto Trait Implementations
impl RefUnwindSafe for Duration
[src]
impl Send for Duration
[src]
impl Sync for Duration
[src]
impl Unpin for Duration
[src]
impl UnwindSafe for Duration
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,