Macro prometheus::labels[][src]

macro_rules! labels {
    ( $( $ KEY : expr => $ VALUE : expr ),* $(,)? ) => { ... };
}

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());