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