pub fn with_recorder<T>(f: impl FnOnce(&dyn Recorder) -> T) -> T
Expand description
Runs the closure with a reference to the current recorder for this scope.
If a local recorder has been set, it will be used. Otherwise, the global recorder will be used. If neither a local recorder or global recorder have been set, a no-op recorder will be used.
It should typically not be necessary to call this function directly, as it is used primarily by generated code. You
should prefer working with the macros provided by metrics
instead: counter!
, gauge!
, histogram!
, etc.