Skip to content

Commit

Permalink
enhancement: expose with_recorder in the docs (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobz authored Oct 12, 2024
1 parent 81e6ee5 commit 0bcfe1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions metrics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `set_global_recorder` now requires that the recorder is `Sync`.
([#511](https://github.com/metrics-rs/metrics/pull/511))
- Bump MSRV to 1.71.1. ([#530](https://github.com/metrics-rs/metrics/pull/530))
- `with_recorder` is no longer hidden in the docs. ([#532](https://github.com/metrics-rs/metrics/pull/532))

## [0.23.0] - 2024-05-27

Expand Down
5 changes: 2 additions & 3 deletions metrics/src/recorder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,8 @@ pub fn with_local_recorder<T>(recorder: &dyn Recorder, f: impl FnOnce() -> T) ->
/// 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.
///
/// This is used primarily by the generated code from the convenience macros used to record metrics.
/// It should typically not be necessary to call this function directly.
#[doc(hidden)]
/// 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.
pub fn with_recorder<T>(f: impl FnOnce(&dyn Recorder) -> T) -> T {
LOCAL_RECORDER.with(|local_recorder| {
if let Some(recorder) = local_recorder.get() {
Expand Down

0 comments on commit 0bcfe1e

Please sign in to comment.