macro_rules! dict {
($($k:expr => $v:expr),* $(,)?) => { ... };
() => { ... };
}Expand description
Create a Value::Dict from key-value pairs (keys like str!, values as Values)
use bencode_minimal::*;
use std::borrow::Cow;
let v = dict! {
"age" => int!(42),
"name" => str!("John"),
};
assert_eq!(v, Value::Dict([
(Cow::Borrowed(b"age".as_ref()), Value::Int(42)),
(Cow::Borrowed(b"name".as_ref()), Value::Str(Cow::Borrowed(b"John"))),
].into_iter().collect()));