Enum Unit
#[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§
§impl<'de> Deserialize<'de> for Unit
impl<'de> Deserialize<'de> for Unit
§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>,
§impl From<&'static str> for Unit
impl From<&'static str> for Unit
§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.
§impl From<Cow<'static, str>> for Unit
impl From<Cow<'static, str>> for Unit
§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.
§impl Serialize for Unit
impl Serialize for Unit
§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,
impl StructuralPartialEq for Unit
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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>
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