pub struct MetricEntry { /* private fields */ }
Expand description
A statically declared metric entry.
Implementations§
Source§impl MetricEntry
impl MetricEntry
Sourcepub fn metric(&self) -> &dyn Metric
pub fn metric(&self) -> &dyn Metric
Get a reference to the metric that this entry corresponds to.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
Get the description of this metric.
Sourcepub fn formatted(&self, format: Format) -> String
pub fn formatted(&self, format: Format) -> String
Format the metric into a string with the given format.
Sourcepub fn is(&self, metric: &dyn Metric) -> bool
pub fn is(&self, metric: &dyn Metric) -> bool
Checks whether metric
is the metric for this entry.
This checks both the type id and the address. Note that it may have
false positives if metric
is a ZST since multiple ZSTs may share
the same address.
Sourcepub fn request_value<T>(&self) -> Option<T>where
T: 'static,
pub fn request_value<T>(&self) -> Option<T>where
T: 'static,
Request a value of type T
from the metric.
This will succeed if the metric’s provide
implementation called
Request::provide_value
with a value of type T
.
Sourcepub fn request_ref<T>(&self) -> Option<&T>where
T: ?Sized + 'static,
pub fn request_ref<T>(&self) -> Option<&T>where
T: ?Sized + 'static,
Request a reference of type T
from the metric.
This will succeed if the metric’s provide
implementation called
Request::provide_ref
with a value of type T
.
Trait Implementations§
Source§impl Debug for MetricEntry
impl Debug for MetricEntry
Source§impl Deref for MetricEntry
impl Deref for MetricEntry
impl Send for MetricEntry
impl Sync for MetricEntry
Auto Trait Implementations§
impl Freeze for MetricEntry
impl !RefUnwindSafe for MetricEntry
impl Unpin for MetricEntry
impl !UnwindSafe for MetricEntry
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