Struct concordium_std::Duration[][src]

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

Duration of time in milliseconds.

Negative durations are not allowed.

Implementations

Construct duration from milliseconds.

Construct duration from seconds.

Construct duration from minutes.

Construct duration from hours.

Construct duration from days.

Get number of milliseconds in the duration.

Get number of seconds in the duration.

Get number of minutes in the duration.

Get number of hours in the duration.

Get number of days in the duration.

Add duration. Returns None instead of overflowing.

Subtract duration. Returns None instead of overflowing.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Attempt to read a structure from a given source, failing if an error occurs during deserialization or reading. Read more

Formats the value using the given formatter. Read more

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:

"10d 1h 2m 3s 4s"

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Attempt to write the structure into the provided writer, failing if only part of the structure could be written. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.