Struct metriken::DynBoxedMetric
source · pub struct DynBoxedMetric<M>where
M: Metric,{ /* private fields */ }
Expand description
A dynamic metric that stores the metric instance on the heap.
This avoids a lot of the hangup with DynPinnedMetric
as it allows for
moving the DynBoxedMetric
without having to worry about pinning or safety
issues. However, this comes at the expense of requiring a heap allocation
for the metric.
§Example
let my_gauge = MetricBuilder::new("my.dynamic.gauge").build(Gauge::new());
my_gauge.increment();
Implementations§
source§impl<M> DynBoxedMetric<M>where
M: Metric,
impl<M> DynBoxedMetric<M>where
M: Metric,
sourcepub fn new(metric: M, entry: MetricEntry) -> DynBoxedMetric<M>
pub fn new(metric: M, entry: MetricEntry) -> DynBoxedMetric<M>
Create a new dynamic metric using the provided metric type with the
provided name
.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for DynBoxedMetric<M>
impl<M> RefUnwindSafe for DynBoxedMetric<M>where
M: RefUnwindSafe,
impl<M> Send for DynBoxedMetric<M>
impl<M> Sync for DynBoxedMetric<M>
impl<M> Unpin for DynBoxedMetric<M>
impl<M> UnwindSafe for DynBoxedMetric<M>where
M: UnwindSafe,
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