Tracking Issue for `hash_map!` macro
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(hash_map_macro)]
This is a tracking issue for https://github.com/rust-lang/libs-team/issues/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: #144070
- Reverted in #148049 due to #147971
- Re-implemented in #154322
- 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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by reading the linked libs-team issue #578 and the implementation history in PRs #144070, #148049, and #154322. Review the unresolved separator and hasher questions, then check the feature lifecycle requirements; done means the final comment period and stabilization PR are complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100