From e9429d8790baafc75d110397540d9c4cefbd8763 Mon Sep 17 00:00:00 2001 From: Michal Turek Date: Fri, 25 Jan 2019 14:00:18 +0100 Subject: [PATCH] #42 Improve API, remove Arc that wraps the closure, rename method. --- src/bucket/atomic.rs | 2 +- src/core/input.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bucket/atomic.rs b/src/bucket/atomic.rs index 72e95d8..008af28 100755 --- a/src/bucket/atomic.rs +++ b/src/bucket/atomic.rs @@ -232,7 +232,7 @@ impl InputScope for AtomicBucket { InputMetric::new(move |value, _labels| scores.update(value)) } - fn observe_helper(&self, name: &str, callback: GaugeCallback) { + fn new_observer(&self, name: &str, callback: GaugeCallback) { let gauge = self.gauge(name); self.inner diff --git a/src/core/input.rs b/src/core/input.rs index 096130b..b6edc9c 100755 --- a/src/core/input.rs +++ b/src/core/input.rs @@ -67,12 +67,12 @@ pub trait InputScope: Flush { /// Observe a gauge value using a callback function. If multiple callbacks are registered under /// the same conflicting key, only the last one will survive. fn observe MetricValue + Send + Sync + 'static>(&self, name: &str, callback: F) where Self: Sized { - self.observe_helper(name, Arc::new(callback)); + self.new_observer(name, Arc::new(callback)); } /// Helper method to make use of `observe()` more pleasant. The Arc wrapper is not necessary /// in the client code now. Consider this as an internal method. - fn observe_helper(&self, _name: &str, _callback: GaugeCallback) { + fn new_observer(&self, _name: &str, _callback: GaugeCallback) { // TODO: Not yet finished, remove default impl. } }