#[derive(Clone)]
pub struct SignalGaugeHandle {
#[cfg(feature = "observability")]
stats: Option<alloc::sync::Arc<crate::profiling::SignalStats>>,
}
impl SignalGaugeHandle {
#[cfg_attr(feature = "observability", allow(dead_code))]
pub(crate) fn inert() -> Self {
Self {
#[cfg(feature = "observability")]
stats: None,
}
}
#[cfg(feature = "observability")]
pub(crate) fn live(stats: alloc::sync::Arc<crate::profiling::SignalStats>) -> Self {
Self { stats: Some(stats) }
}
pub fn update(&self, value: f64) {
#[cfg(feature = "observability")]
if let Some(stats) = &self.stats {
stats.update(value);
}
#[cfg(not(feature = "observability"))]
let _ = value;
}
}