All Projects → estk → literally

estk / literally

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Rust map and set literals

Programming Languages

rust
11053 projects

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].