macron_collections/
hash_map.rs1#[cfg(not(feature = "from_macron"))]
3#[macro_export]
4macro_rules! hash_map {
5 ($($tokens:tt)*) => {{
6 ::std::collections::HashMap::from( ::macron_collections::map!( $($tokens)* ) )
7 }};
8}
9#[cfg(feature = "from_macron")]
11#[macro_export]
12macro_rules! hash_map {
13 ($($tokens:tt)*) => {{
14 ::std::collections::HashMap::from( ::macron::map!( $($tokens)* ) )
15 }};
16}
17
18#[cfg(not(feature = "from_macron"))]
20#[macro_export]
21macro_rules! auto_hash_map {
22 ($($tokens:tt)*) => {{
23 let fields = ::macron_collections::map!($($tokens)*);
24 let map: ::std::collections::HashMap<String, _> = fields
25 .into_iter()
26 .map(|(k, v)| (k.into(), v.into()))
27 .collect();
28 map
29 }};
30}
31#[cfg(feature = "from_macron")]
33#[macro_export]
34macro_rules! auto_hash_map {
35 ($($tokens:tt)*) => {{
36 let fields = ::macron::map!($($tokens)*);
37 let map: ::std::collections::HashMap<String, _> = fields
38 .into_iter()
39 .map(|(k, v)| (k.into(), v.into()))
40 .collect();
41 map
42 }};
43}
44
45#[cfg(not(feature = "from_macron"))]
47#[macro_export]
48macro_rules! str_hash_map {
49 ($($tokens:tt)*) => {{
50 let fields = ::macron_collections::map!($($tokens)*);
51 let map: ::std::collections::HashMap<String, _> = fields
52 .into_iter()
53 .map(|(k, v)| (String::from(k), String::from(v)))
54 .collect();
55 map
56 }};
57}
58#[cfg(feature = "from_macron")]
60#[macro_export]
61macro_rules! str_hash_map {
62 ($($tokens:tt)*) => {{
63 let fields = ::macron::map!($($tokens)*);
64 let map: ::std::collections::HashMap<String, _> = fields
65 .into_iter()
66 .map(|(k, v)| (String::from(k), String::from(v)))
67 .collect();
68 map
69 }};
70}