Skip to content

Commit

Permalink
Format example better
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Berktold <jberktold@roblox.com>
  • Loading branch information
JanBerktold committed Nov 14, 2022
1 parent 4cf4a40 commit b52e885
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pulling_gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ use protobuf::RepeatedField;
/// # Examples
/// ```
/// # use prometheus::{Registry, PullingGauge};
/// # // We are stubbing out std::thread::available_parallelism since it's not available in the
/// # // oldest Rust version that we support.
/// # fn available_parallelism() -> f64 { 0.0 }
///
/// let registry = Registry::new();
/// let gauge = PullingGauge::new("available_parallelism", "The available parallelism, usually the numbers of logical cores.", Box::new(|| std::thread::available_parallelism().unwrap().get() as f64)).unwrap();
/// let gauge = PullingGauge::new(
/// "available_parallelism",
/// "The available parallelism, usually the numbers of logical cores.",
/// Box::new(|| available_parallelism())
/// ).unwrap();
/// registry.register(Box::new(gauge));
/// ```
#[derive(Clone)]
Expand Down

0 comments on commit b52e885

Please sign in to comment.