[−][src]Enum metrics::Unit
Units for a given metric.
While metrics do not necessarily need to be tied to a particular unit to be recorded, some downstream systems natively support defining units and so they can be specified during registration.
Variants
Count.
Percentage.
Seconds.
One second is equal to 1000 milliseconds.
Milliseconds.
One millisecond is equal to 1000 microseconds.
Microseconds.
One microsecond is equal to 1000 nanoseconds.
Nanoseconds.
Tebibytes.
One tebibyte is equal to 1024 gigibytes.
Gigibytes.
One gigibyte is equal to 1024 mebibytes.
Mebibytes.
One mebibyte is equal to 1024 kibibytes.
Kibibytes.
One kibibyte is equal to 1024 bytes.
Bytes.
Terabits per second.
One terabit is equal to 1000 gigabits.
Gigabits per second.
One gigabit is equal to 1000 megabits.
Megabits per second.
One megabit is equal to 1000 kilobits.
Kilobits per second.
One kilobit is equal to 1000 bits.
Bits per second.
Count per second.
Implementations
impl Unit
[src]
pub fn as_str(&self) -> &str
[src]
Gets the string form of this Unit
.
pub fn as_canonical_label(&self) -> &str
[src]
Gets the canonical string label for the given unit.
For example, the canonical label for Seconds
would be s
, while for Nanoseconds
,
it would be ns
.
Not all units have a meaningful display label and so some may be empty.
pub fn from_str(s: &str) -> Option<Unit>
[src]
Converts the string representation of a unit back into Unit
if possible.
The value passed here should match the output of Unit::as_str
.
pub fn is_time_based(&self) -> bool
[src]
Whether or not this unit relates to the measurement of time.
pub fn is_data_based(&self) -> bool
[src]
Whether or not this unit relates to the measurement of data.
pub fn is_data_rate_based(&self) -> bool
[src]
Whether or not this unit relates to the measurement of data rates.
Trait Implementations
impl Clone for Unit
[src]
impl Debug for Unit
[src]
impl PartialEq<Unit> for Unit
[src]
pub fn eq(&self, other: &Unit) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralPartialEq for Unit
[src]
Auto Trait Implementations
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
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, 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>,