Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @shepmaster (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
Maybe this should be in an RFC? |
|
Hey @cool-cool-sweat, this looks really neat! This feature is already present in an active RFC. You might want to look through it to see if it meets your needs, and possibly make your voice heard there: rust-lang/rfcs#542 |
|
I'm gonna close this in favour of the pull request I've made against maplit |
These macros let you make HashMaps and HashSets filled w/ items in 1 pass much like vec!. They can also be used as a slightly shorter alternative to HashMap::new()/HashSet::new() for empty HashMaps/HashSets
HashMap!'s syntax's meant to be similar to using the insert method:
No feature gates coz apparently feature gates don't work for macros
Issues: these macros're available even when HashMap/HashSet ain't in scope, tho I ain't sure how much of a problem that is in practice since I imagine people'll type
use std::collections::HashMap1stMaybe add HashMap and HashSet to the prelude but I don't think that's likely