[][src]Enum glean_ffi::TimeUnit

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

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

impl TimeUnit[src]

pub fn format_pattern(self) -> &'static str[src]

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

pub fn duration_convert(self, duration: Duration) -> u64[src]

Converts a duration to the requested time unit.

Arguments

  • duration - the duration to convert.

Returns

The integer representation of the converted duration.

pub fn as_nanos(self, duration: u64) -> u64[src]

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

impl Clone for TimeUnit[src]

impl Copy for TimeUnit[src]

impl Debug for TimeUnit[src]

impl<'de> Deserialize<'de> for TimeUnit[src]

impl PartialEq<TimeUnit> for TimeUnit[src]

impl Serialize for TimeUnit[src]

impl StructuralPartialEq for TimeUnit[src]

impl TryFrom<i32> for TimeUnit[src]

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).

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for TimeUnit

impl Send for TimeUnit

impl Sync for TimeUnit

impl Unpin for TimeUnit

impl UnwindSafe for TimeUnit

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> EncodableKey for T where
    T: Serialize

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,