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 copy 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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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
Checks if this value is equivalent to the given key. Read more
§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>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more