#[repr(i32)]
pub enum TimeUnit {
    Nanosecond,
    Microsecond,
    Millisecond,
    Second,
    Minute,
    Hour,
    Day,
}
Expand description

Different resolutions supported by the time related metric types (e.g. DatetimeMetric).

Variants

Nanosecond

Truncate to nanosecond precision.

Microsecond

Truncate to microsecond precision.

Millisecond

Truncate to millisecond precision.

Second

Truncate to second precision.

Minute

Truncate to minute precision.

Hour

Truncate to hour precision.

Day

Truncate to day precision.

Implementations

Formats the given time unit, truncating the time if needed.

Converts a duration to the requested time unit.

Arguments
  • duration - the duration to convert.
Returns

The integer representation of the converted duration.

Converts a duration in the given unit to nanoseconds.

Arguments
  • duration - the duration to convert.
Returns

The integer representation of the nanosecond duration.

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

Deserialize this value from the given Serde deserializer. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Trait implementation for converting an integer value to a TimeUnit.

This is used in the FFI code.

Please note that values should match the ordering of the platform specific side of things (e.g. Kotlin implementation).

The type returned in the event of a conversion error.

Performs the conversion.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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

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.