pub trait MeasureLatency: Sized {
// Required methods
fn measure_latency(&self) -> ActiveMeasurementGuard<'_, Self>;
fn finish_measurement(&self, milliseconds: f64);
}
Expand description
An extension trait for metrics that can be used to measure latencies.
Required Methods§
Sourcefn measure_latency(&self) -> ActiveMeasurementGuard<'_, Self>
fn measure_latency(&self) -> ActiveMeasurementGuard<'_, Self>
Starts measuring the latency, finishing when the returned
ActiveMeasurementGuard
is dropped.
Sourcefn finish_measurement(&self, milliseconds: f64)
fn finish_measurement(&self, milliseconds: f64)
Updates the metric with measured latency in milliseconds
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.