Macro prometheus::labels
source · [−]macro_rules! labels {
( $( $ KEY : expr => $ VALUE : expr ),* $(,)? ) => { ... };
}
Expand description
Create labels with specified name-value pairs.
Examples
let labels = labels!{
"test" => "hello",
"foo" => "bar",
};
assert_eq!(labels.len(), 2);
assert!(labels.get("test").is_some());
assert_eq!(*(labels.get("test").unwrap()), "hello");
let labels: HashMap<&str, &str> = labels!{};
assert!(labels.is_empty());