#hash-map #macro #map #hash #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

#1654 in Rust patterns

Download history 3457/week @ 2024-07-21 3395/week @ 2024-07-28 3047/week @ 2024-08-04 3455/week @ 2024-08-11 3028/week @ 2024-08-18 3707/week @ 2024-08-25 3124/week @ 2024-09-01 3577/week @ 2024-09-08 2750/week @ 2024-09-15 1148/week @ 2024-09-22 1739/week @ 2024-09-29 857/week @ 2024-10-06 1034/week @ 2024-10-13 1548/week @ 2024-10-20 941/week @ 2024-10-27 890/week @ 2024-11-03

4,458 downloads per month
Used in 9 crates (7 directly)

MIT/Apache

17KB
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