pub struct ClosureMeasurable<F>(/* private fields */)
where
F: Fn(&MetricConfig, i64) -> f64 + Send + Sync;Expand description
A Measurable backed by a closure, mirroring Java’s functional-interface
usage of Measurable (e.g. (config, now) -> TimeUnit.SECONDS.convert(...)
in KafkaConsumerMetrics / HeartbeatMetricsManager). The symmetric
counterpart of crate::common::metrics::gauge::new.
Implementations§
Trait Implementations§
Source§impl<F> Debug for ClosureMeasurable<F>
impl<F> Debug for ClosureMeasurable<F>
Source§impl<F> Measurable for ClosureMeasurable<F>
impl<F> Measurable for ClosureMeasurable<F>
Auto Trait Implementations§
impl<F> Freeze for ClosureMeasurable<F>where
F: Freeze,
impl<F> RefUnwindSafe for ClosureMeasurable<F>where
F: RefUnwindSafe,
impl<F> Send for ClosureMeasurable<F>
impl<F> Sync for ClosureMeasurable<F>
impl<F> Unpin for ClosureMeasurable<F>where
F: Unpin,
impl<F> UnsafeUnpin for ClosureMeasurable<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for ClosureMeasurable<F>where
F: 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
Source§impl<M> MetricValueProvider for Mwhere
M: Measurable,
impl<M> MetricValueProvider for Mwhere
M: Measurable,
Source§fn value(&self, config: &MetricConfig, now: i64) -> MetricValue
fn value(&self, config: &MetricConfig, now: i64) -> MetricValue
Returns the current value associated with this metric. Read more
Source§fn type_name(&self) -> Option<&'static str>
fn type_name(&self) -> Option<&'static str>
Returns the provider’s type name, as
KafkaMetric’s Display reports
it, or None for a provider that is a closure. Read more