Add into_keys
and into_values
to associative maps
#55214
Labels
A-collections
Area: `std::collections`
A-iterators
Area: Iterators
C-feature-accepted
Category: A feature request that has been accepted pending implementation.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Associative maps (
HashMap
andBTreeMap
) in Rust are currently missing two methods to get owning iterators to their keys or values.We have
iter
to get key-value reference pairs,iter_mut
to get key-value mutable reference pairs andinto_iter
to get owned key-value pairs.I'd expect
keys
andvalues
to offer a similar trio of methods (with an exception forkeys_mut
of course).values_mut
is there, but theinto
variants are missing for seemingly no good reason.As an example implementation (but perhaps we can do better):
The text was updated successfully, but these errors were encountered: