#hash #map #macros #common

common_macros

Provides common macros like hash_map! or hash_set! (WIP)

3 unstable releases

0.1.1 Mar 30, 2019
0.1.0 Mar 30, 2019
0.0.1-wip Mar 29, 2019

#14 in #hash-map

Download history 963/week @ 2023-01-14 1162/week @ 2023-01-21 765/week @ 2023-01-28 608/week @ 2023-02-04 721/week @ 2023-02-11 866/week @ 2023-02-18 1002/week @ 2023-02-25 1063/week @ 2023-03-04 902/week @ 2023-03-11 1224/week @ 2023-03-18 865/week @ 2023-03-25 1140/week @ 2023-04-01 1154/week @ 2023-04-08 1361/week @ 2023-04-15 1254/week @ 2023-04-22 1158/week @ 2023-04-29

5,048 downloads per month
Used in 9 crates (6 directly)

MIT/Apache

16KB
325 lines

common_macros Crates.io common_macros maintenance License License

**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!

Example

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);
}

License

Licensed under either of

at your option.

Contribution

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.

No runtime deps