Skip to content

Commit

Permalink
fralalonde#42 Improve API, remove Arc that wraps the closure, rename …
Browse files Browse the repository at this point in the history
…method.
  • Loading branch information
mixalturek committed Jan 25, 2019
1 parent 042139a commit e9429d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/bucket/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/core/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F: Fn() -> 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.
}
}
Expand Down

0 comments on commit e9429d8

Please sign in to comment.