pub enum MetricUnit {
    Duration(DurationUnit),
    Information(InformationUnit),
    Fraction(FractionUnit),
    Custom(CustomUnit),
    None,
}Expand description
The unit of measurement of a metric value.
Units augment metric values by giving them a magnitude and semantics. There are certain types of
units that are subdivided in their precision, such as the DurationUnit for time
measurements.
Units and their precisions are uniquely represented by a string identifier.
Variants§
Duration(DurationUnit)
A time duration, defaulting to "millisecond".
Information(InformationUnit)
Size of information derived from bytes, defaulting to "byte".
Fraction(FractionUnit)
Fractions such as percentages, defaulting to "ratio".
Custom(CustomUnit)
User-defined units without built-in conversion or default.
None
Untyped value without a unit ("").
Implementations§
Trait Implementations§
Source§impl Clone for MetricUnit
 
impl Clone for MetricUnit
Source§fn clone(&self) -> MetricUnit
 
fn clone(&self) -> MetricUnit
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl Debug for MetricUnit
 
impl Debug for MetricUnit
Source§impl Default for MetricUnit
 
impl Default for MetricUnit
Source§fn default() -> MetricUnit
 
fn default() -> MetricUnit
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MetricUnit
 
impl<'de> Deserialize<'de> for MetricUnit
Source§fn deserialize<D>(
    deserializer: D,
) -> Result<MetricUnit, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(
    deserializer: D,
) -> Result<MetricUnit, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for MetricUnit
 
impl Display for MetricUnit
Source§impl Empty for MetricUnit
 
impl Empty for MetricUnit
Source§impl FromStr for MetricUnit
 
impl FromStr for MetricUnit
Source§type Err = ParseMetricUnitError
 
type Err = ParseMetricUnitError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<MetricUnit, <MetricUnit as FromStr>::Err>
 
fn from_str(s: &str) -> Result<MetricUnit, <MetricUnit as FromStr>::Err>
Parses a string 
s to return a value of this type. Read moreSource§impl FromValue for MetricUnit
 
impl FromValue for MetricUnit
Source§fn from_value(value: Annotated<Value>) -> Annotated<MetricUnit>
 
fn from_value(value: Annotated<Value>) -> Annotated<MetricUnit>
Creates a meta structure from an annotated boxed value.
Source§impl Hash for MetricUnit
 
impl Hash for MetricUnit
Source§impl IntoValue for MetricUnit
 
impl IntoValue for MetricUnit
Source§fn into_value(self) -> Valuewhere
    MetricUnit: Sized,
 
fn into_value(self) -> Valuewhere
    MetricUnit: Sized,
Boxes the meta structure back into a value.
Source§fn serialize_payload<S>(
    &self,
    s: S,
    _behavior: SkipSerialization,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
 
fn serialize_payload<S>( &self, s: S, _behavior: SkipSerialization, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
Efficiently serializes the payload directly.
Source§impl PartialEq for MetricUnit
 
impl PartialEq for MetricUnit
Source§impl Serialize for MetricUnit
 
impl Serialize for MetricUnit
Source§fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
 
fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for MetricUnit
impl Eq for MetricUnit
impl StructuralPartialEq for MetricUnit
Auto Trait Implementations§
impl Freeze for MetricUnit
impl RefUnwindSafe for MetricUnit
impl Send for MetricUnit
impl Sync for MetricUnit
impl Unpin for MetricUnit
impl UnwindSafe for MetricUnit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to 
key and return true if they are equal.§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
§impl<T> ToStringFallible for Twhere
    T: Display,
 
impl<T> ToStringFallible for Twhere
    T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
 
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.