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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::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§impl FromValue for MetricUnit
impl FromValue for MetricUnit
source§fn from_value(value: Annotated<Value>) -> Annotated<Self>
fn from_value(value: Annotated<Value>) -> Annotated<Self>
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
Self: Sized,
fn into_value(self) -> Valuewhere
Self: Sized,
Boxes the meta structure back into a value.
source§fn serialize_payload<S>(
&self,
s: S,
_behavior: SkipSerialization,
) -> Result<S::Ok, S::Error>where
Self: Sized,
S: Serializer,
fn serialize_payload<S>(
&self,
s: S,
_behavior: SkipSerialization,
) -> Result<S::Ok, S::Error>where
Self: Sized,
S: Serializer,
Efficiently serializes the payload directly.
§fn extract_child_meta(&self) -> BTreeMap<String, MetaTree>where
Self: Sized,
fn extract_child_meta(&self) -> BTreeMap<String, MetaTree>where
Self: Sized,
Extracts children meta map out of a value.
§fn extract_meta_tree(value: &Annotated<Self>) -> MetaTreewhere
Self: Sized,
fn extract_meta_tree(value: &Annotated<Self>) -> MetaTreewhere
Self: Sized,
Extracts the meta tree out of annotated value. Read more
source§impl PartialEq for MetricUnit
impl PartialEq for MetricUnit
source§impl Serialize for MetricUnit
impl Serialize for MetricUnit
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
)