pub fn meter_with<T, F>(&self, id: T, make_meter: F) -> Arc<Meter>
    where
        T: Into<MetricId>,
        F: FnOnce() -> Meter,
    {
        match Arc::make_mut(&mut self.metrics.lock()).entry(Arc::new(id.into())) {
            Entry::Occupied(e) => match e.get() {
                Metric::Meter(m) => m.clone(),
                _ => panic!("metric already registered as a non-meter: {:?}", e.key()),
            },
            Entry::Vacant(e) => {
                let meter = Arc::new(make_meter());
                e.insert(Metric::Meter(meter.clone()));
                meter
            }
        }
    }
/// Returns the meter with the specified ID, using make_meter to create it if absent.
///
/// # Panics
///
/// Panics if a metric is registered with the ID that is not a meter.
Returns the meter with the specified ID, using make_meter to create it if absent.
Returns the meter with the specified ID using make_meter to create it if absent .
pub fn meter_with<T, F>(&self, id: T, make_meter: F) -> Arc<Meter>
    where
        T: Into<MetricId>,
        F: FnOnce() -> Meter,
    {
        match Arc::make_mut(&mut self.metrics.lock()).entry(Arc::new(id.into())) {
            Entry::Occupied(e) => match e.get() {
                Metric::Meter(m) => m.clone(),
                _ => panic!("metric already registered as a non-meter: {:?}", e.key()),
            },
            Entry::Vacant(e) => {
                let meter = Arc::new(make_meter());
                e.insert(Metric::Meter(meter.clone()));
                meter
            }
        }
    }
pub fn meter_with < T , F > ( & self , id : T , make_meter : F ) -> Arc < Meter > where T : Into < MetricId > , F : FnOnce ( ) -> Meter , { match Arc :: make_mut ( & mut self . metrics . lock ( ) ) . entry ( Arc :: new ( id . into ( ) ) ) { Entry :: Occupied ( e ) => match e . get ( ) { Metric :: Meter ( m ) => m . clone ( ) , _ => panic ! ( " " e key ( ) ) , } , Entry :: Vacant ( e ) => { let meter = Arc :: new ( make_meter ( ) ) ; e . insert ( Metric :: Meter ( meter . clone ( ) ) ) ; meter } } }
Returns the meter with the specified ID, using make_meter to create it if absent.
Returns the meter with the specified ID using make_meter to create it if absent .
&self
id
T
make_meter
F
&self
id
T
make_meter
F
panics
Panics if a metric is registered with the ID that is not a meter.
Panics if a metric is registered with the ID that is not a meter .