-
Couldn't load subscription status.
- Fork 13.9k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(hash_map_macro)]
This is a tracking issue for rust-lang/libs-team#578
The hash_map! macro is like the vec! macro but for HashMaps, it aims to help create hash_maps with set keys for functions that require dynamic key value pairs such as a templating engine asking to fill the templates with a HashMap.
Public API
use std::hash_map;
fn main() {
let map = hash_map! {
"key" => "value",
"key2" => "value2"
}; // uses type inference.
for (key, value) in map {
println!("{key:?} => {value:?}");
}
}Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- Implementation: Implement
hash_mapmacro #144070 - Reverted in Revert "feat: implement
hash_map!macro" #148049 due to regression: hashmap macro stuff #147971 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- What separator should we use? the main proposition was
=>,:was also proposed. - Should this macro allow using other hashers in it's syntax? If so, how?
Footnotes
Andras-Csanyi, chikof, Kobzol, Xendergo, aznhe21 and 8 morejoseluis
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.