macro_rules! labels {
(@single $($x:tt)*) => { ... };
(@count $($rest:expr),*) => { ... };
($($key:expr => $value:expr,)+) => { ... };
($($key:expr => $value:expr),*) => { ... };
() => { ... };
}
Expand description
Create Labels from a list of key-value pairs Adapted from the hashmap!() macro in the maplit crate.
Example
#[macro_use] ///
use dipstick::*;
let labels = labels!{
"a" => "1",
"b" => "2",
};
assert_eq!(labels.lookup("a"), Some(::std::sync::Arc::new("1".into())));
assert_eq!(labels.lookup("b"), Some(::std::sync::Arc::new("2".into())));
assert_eq!(labels.lookup("c"), None);