#[non_exhaustive]pub enum Unit {
}Expand description
A unit for a metric.
Recognized units are explicitly enumerated, while other units can be set using the
Unit::Other variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Nanosecond
Microsecond
Millisecond
Second
Minute
Hour
Day
Week
Bit
Byte
Kilobyte
Kibibyte
Megabyte
Mebibyte
Gigabyte
Gibibyte
Terabyte
Tebibyte
Petabyte
Pebibyte
Exabyte
Exbibyte
Ratio
Percent
Other(Cow<'static, str>)
Any other unit, which may not be recognized by the Sentry UI.
We advise against constructing this variant directly; instead, rely on the From
implementations to convert from a String, Cow<'static, str>, or &'static str,
as these implementations normalize to the known units, including to any units we
may add in the future as we add them.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Unit
impl<'de> Deserialize<'de> for Unit
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Unit, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Unit, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl From<&'static str> for Unit
impl From<&'static str> for Unit
Source§fn from(value: &'static str) -> Unit
fn from(value: &'static str) -> Unit
Convert a &'static str to a Unit. Known units (including standard symbols,
such as “MB” for “megabyte” or “ms” for “millisecond”) are converted to the appropriate
enum variant, with other unknown units being mapped to Unit::Other.
Source§impl From<Cow<'static, str>> for Unit
impl From<Cow<'static, str>> for Unit
Source§fn from(value: Cow<'static, str>) -> Unit
fn from(value: Cow<'static, str>) -> Unit
Convert a Cow<'static, str> to a Unit. Known units (including standard symbols,
such as “MB” for “megabyte” or “ms” for “millisecond”) are converted to the appropriate
enum variant, with other unknown units being mapped to Unit::Other.