[][src]Struct concordium_std::Duration

#[repr(transparent)]pub struct Duration { /* fields omitted */ }

Duration of time in milliseconds.

Negative durations are not allowed.

Implementations

impl Duration[src]

pub fn from_millis(milliseconds: u64) -> Duration[src]

Construct duration from milliseconds.

pub fn from_seconds(seconds: u64) -> Duration[src]

Construct duration from seconds.

pub fn from_minutes(minutes: u64) -> Duration[src]

Construct duration from minutes.

pub fn from_hours(hours: u64) -> Duration[src]

Construct duration from hours.

pub fn from_days(days: u64) -> Duration[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<Duration>[src]

Add duration. Returns None instead of overflowing.

pub fn checked_sub(self, other: Duration) -> Option<Duration>[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]

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 milliseconds
  • s for seconds
  • m for minutes
  • h for hours
  • d for days

Example

The duration of 10 days, 1 hour, 2minutes and 7 seconds is:

This example is not tested
"10d 1h 2m 3s 4s"

type Err = ParseDurationError

The associated error which can be returned from parsing.

impl Ord for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl SchemaType for Duration[src]

impl Serial for Duration[src]

impl StructuralEq for Duration[src]

impl StructuralPartialEq for Duration[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<A> Serialize for A where
    A: Serial + Deserial
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.