You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a function to get the key from a HashMap #43143
@oli-obk the entry api would not work, because it requires &mut, this usecase would require the ability to have multiple references and therefore just &
I don't love the name get_both but I agree that this is basic functionality that HashMap should expose. I would welcome a PR and we can refine the name separately.
Activity
oli-obk commentedon Jul 10, 2017
If
OccupiedEntry::keyreturned the reference with the proper lifetime, we could already do this in usercode.iqualfragile commentedon Jul 10, 2017
@oli-obk the entry api would not work, because it requires &mut, this usecase would require the ability to have multiple references and therefore just &
dtolnay commentedon Nov 19, 2017
I don't love the name
get_bothbut I agree that this is basic functionality that HashMap should expose. I would welcome a PR and we can refine the name separately.Rollup merge of rust-lang#49346 - Diggsey:hashmap-get-pair, r=Mark-Si…
Rollup merge of rust-lang#49346 - Diggsey:hashmap-get-pair, r=Mark-Si…