#lang #language #macro #dictionary #std-lib

literally

Macro literals for members of std::collections

3 releases

0.1.3 Apr 18, 2020
0.1.2 Apr 18, 2020
0.1.1 Apr 15, 2020
0.1.0 Apr 14, 2020

#796 in Rust patterns

Download history 403/week @ 2022-08-13 539/week @ 2022-08-20 487/week @ 2022-08-27 2402/week @ 2022-09-03 1138/week @ 2022-09-10 1127/week @ 2022-09-17 1587/week @ 2022-09-24 891/week @ 2022-10-01 883/week @ 2022-10-08 643/week @ 2022-10-15 782/week @ 2022-10-22 1203/week @ 2022-10-29 1061/week @ 2022-11-05 1041/week @ 2022-11-12 923/week @ 2022-11-19 598/week @ 2022-11-26

3,768 downloads per month
Used in 11 crates (6 directly)

MIT/Apache

8KB
87 lines

Literally

docs crates.io License: MIT OR Apache-2.0 CI Minimum rustc version

I found the methods and ergonomics of maplit aggravating so I made this. It's basically the same code except that the names are different and the values are .into()'d.

Enjoy.

Example

use std::collections::{HashMap, HashSet};
use literally::{hmap, hset};
let m: HashMap<String, HashSet<String>> = hmap!{ 
    "key" => hset!{
        "value"
    }
};
assert_eq!(m.get("key").unwrap().get("value"), Some(&"value".to_string()))

Rust Version Requirements

1.38+

License

Licensed under either of the following at your option.

Credit

Like I said, this is maplit but with ergonomics changes. All credit should be directed there. Again, I literally copied and pasted the code from maplit and changed the ergonomics slightly.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

No runtime deps