#[macro_export]
macro_rules! stdhashmap {
(@single $($x:tt)*) => (());
(@count $($rest:expr),*) => (<[()]>::len(&[$($crate::stdhashmap!(@single $rest)),*]));
($($key:expr => $value:expr,)+) => { $crate::stdhashmap!($($key => $value),+) };
($($key:expr => vec![$($value:expr),*]),*) => {
$crate::stdhashmap!($($key => [$($value),*]),*)
};
($($key:expr => [$($value:expr),*]),*) => {
{
let _cap = $crate::stdhashmap!(@count $($key),*);
let mut _map = ::std::collections::HashMap::with_capacity(_cap);
$(
let mut _arr = Vec::new();
$(
_arr.push($value.into());
)*
_map.insert($key.into(), _arr);
)*
_map
}
};
($($key:expr => $value:expr),*) => {
{
let _cap = $crate::stdhashmap!(@count $($key),*);
let mut _map = ::std::collections::HashMap::with_capacity(_cap);
$(
_map.insert($key.into(), $value.into());
)*
_map
}
};
}