diff --git a/src/metrics/family.rs b/src/metrics/family.rs index 3557d78..d3d55c6 100644 --- a/src/metrics/family.rs +++ b/src/metrics/family.rs @@ -222,15 +222,15 @@ where /// let family = Family::, Counter>::default(); /// /// // Will create and return the metric with label `method="GET"` when first called. - /// family.get_or_create_clone(&vec![("method".to_owned(), "GET".to_owned())]).inc(); + /// family.get_or_create_owned(&vec![("method".to_owned(), "GET".to_owned())]).inc(); /// /// // Will return a clone of the existing metric on all subsequent calls. - /// family.get_or_create_clone(&vec![("method".to_owned(), "GET".to_owned())]).inc(); + /// family.get_or_create_owned(&vec![("method".to_owned(), "GET".to_owned())]).inc(); /// ``` /// /// Callers wishing to avoid a clone of the metric `M` can call [`Family::get_or_create()`] to /// return a reference to the metric instead. - pub fn get_or_create_clone(&self, label_set: &S) -> M { + pub fn get_or_create_owned(&self, label_set: &S) -> M { use std::ops::Deref; let guard = self.get_or_create(label_set); @@ -261,7 +261,7 @@ impl> Family MappedRwLockReadGuard { if let Some(metric) = self.get(label_set) { @@ -549,7 +549,7 @@ mod tests { assert!(non_existent_string.is_none()); } - /// Tests that [`Family::get_or_create_clone()`] does not cause deadlocks. + /// Tests that [`Family::get_or_create_owned()`] does not cause deadlocks. #[test] fn counter_family_does_not_deadlock() { /// A structure we'll place two counters into, within a single expression. @@ -560,8 +560,8 @@ mod tests { let family = Family::<(&str, &str), Counter>::default(); let s = S { - apples: family.get_or_create_clone(&("kind", "apple")), - oranges: family.get_or_create_clone(&("kind", "orange")), + apples: family.get_or_create_owned(&("kind", "apple")), + oranges: family.get_or_create_owned(&("kind", "orange")), }; s.apples.inc();