Enum snarkos_metrics::Unit
source · [−]pub enum Unit {
Show 17 variants
Count,
Percent,
Seconds,
Milliseconds,
Microseconds,
Nanoseconds,
Tebibytes,
Gigibytes,
Mebibytes,
Kibibytes,
Bytes,
TerabitsPerSecond,
GigabitsPerSecond,
MegabitsPerSecond,
KilobitsPerSecond,
BitsPerSecond,
CountPerSecond,
}
Expand description
Units for a given metric.
While metrics do not necessarily need to be tied to a particular unit to be recorded, some downstream systems natively support defining units and so they can be specified during registration.
Variants
Count
Count.
Percent
Percentage.
Seconds
Seconds.
One second is equal to 1000 milliseconds.
Milliseconds
Milliseconds.
One millisecond is equal to 1000 microseconds.
Microseconds
Microseconds.
One microsecond is equal to 1000 nanoseconds.
Nanoseconds
Nanoseconds.
Tebibytes
Tebibytes.
One tebibyte is equal to 1024 gigibytes.
Gigibytes
Gigibytes.
One gigibyte is equal to 1024 mebibytes.
Mebibytes
Mebibytes.
One mebibyte is equal to 1024 kibibytes.
Kibibytes
Kibibytes.
One kibibyte is equal to 1024 bytes.
Bytes
Bytes.
TerabitsPerSecond
Terabits per second.
One terabit is equal to 1000 gigabits.
GigabitsPerSecond
Gigabits per second.
One gigabit is equal to 1000 megabits.
MegabitsPerSecond
Megabits per second.
One megabit is equal to 1000 kilobits.
KilobitsPerSecond
Kilobits per second.
One kilobit is equal to 1000 bits.
BitsPerSecond
Bits per second.
CountPerSecond
Count per second.
Implementations
sourceimpl Unit
impl Unit
sourcepub fn as_canonical_label(&self) -> &str
pub fn as_canonical_label(&self) -> &str
Gets the canonical string label for the given unit.
For example, the canonical label for Seconds
would be s
, while for Nanoseconds
,
it would be ns
.
Not all units have a meaningful display label and so some may be empty.
sourcepub fn from_string(s: &str) -> Option<Unit>
pub fn from_string(s: &str) -> Option<Unit>
Converts the string representation of a unit back into Unit
if possible.
The value passed here should match the output of Unit::as_str
.
sourcepub fn is_time_based(&self) -> bool
pub fn is_time_based(&self) -> bool
Whether or not this unit relates to the measurement of time.
sourcepub fn is_data_based(&self) -> bool
pub fn is_data_based(&self) -> bool
Whether or not this unit relates to the measurement of data.
sourcepub fn is_data_rate_based(&self) -> bool
pub fn is_data_rate_based(&self) -> bool
Whether or not this unit relates to the measurement of data rates.
Trait Implementations
impl Copy for Unit
impl StructuralPartialEq for Unit
Auto Trait Implementations
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more