Crates.io | common_macros |
lib.rs | common_macros |
version | 0.1.1 |
source | src |
created_at | 2019-03-29 20:18:17.594761 |
updated_at | 2019-03-30 13:50:53.4177 |
description | Provides common macros like `hash_map!` or `hash_set!` (WIP) |
homepage | |
repository | https://github.com/rustonaut/common_macros |
max_upload_size | |
id | 124654 |
size | 29,036 |
**provides common macros like hash_map!
Rust crate providing some common macros.
Currently following macros are exported:
hash_map!
hash_set!
b_tree_map!
b_tree_set!
const_expr_count!
use std::collections::HashMap;
use common_macros::hash_map;
fn main() {
let map_a = hash_map! {
"foo" => vec![0,1,2],
"bar" => vec![3,4,5]
};
// expands to roughly
let map_b = {
let mut map = HashMap::with_capacity(2);
map.insert("foo", vec![0,1,2]);
map.insert("bar", vec![3,4,5]);
map
};
assert_eq!(map_a, map_b);
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.