Change:
} } <ins> #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> Iterator for IntoKeys<K, V> { type Item = K; fn next(&mut self) -> Option<K> { self.inner.next().map(|(k, _)| k) } fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } fn last(mut self) -> Option<K> { self.next_back() } fn min(mut self) -> Option<K> { self.next() } fn max(mut self) -> Option<K> { self.next_back() } } #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> DoubleEndedIterator for IntoKeys<K, V> { fn next_back(&mut self) -> Option<K> { self.inner.next_back().map(|(k, _)| k) } } #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> ExactSizeIterator for IntoKeys<K, V> { fn len(&self) -> usize { self.inner.len() } } #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> FusedIterator for IntoKeys<K, V> {} #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> Iterator for IntoValues<K, V> { type Item = V; fn next(&mut self) -> Option<V> { self.inner.next().map(|(_, v)| v) } fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } fn last(mut self) -> Option<V> { self.next_back() } } #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> DoubleEndedIterator for IntoValues<K, V> { fn next_back(&mut self) -> Option<V> { self.inner.next_back().map(|(_, v)| v) } } #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> ExactSizeIterator for IntoValues<K, V> { fn len(&self) -> usize { self.inner.len() } } #[unstable(feature = "map_into_keys_values", issue = "75294")] impl<K, V> FusedIterator for IntoValues<K, V> {} </ins> #[stable(feature = "btree_range", since = "1.17.0")] impl<'a, K, V> DoubleEndedIterator for Range<'a, K, V> { fn next_back(&mut self) -> Option<(&'a K, &'a V)> {

Discussion:
Associative maps ( and ) in Rust are currently missing two methods to get owning iterators to their keys or values. We have to get key-value reference pairs, to get key-value mutable reference pairs and to get owned key-value pairs. I'd expect and to offer a similar trio of methods (with an exception for of course). is there, but the variants are missing for seemingly no good reason. As an example implementation (but perhaps we can do better):
I would accept a PR to introduce unstable intokeys() and intovalues().
Hi, I’m interested in working on this but I have a question regarding the implementation. I guess we can implement this in two ways. First one is implementing like the example in the first comment, like returning . And the second option is to return a struct of its own (like a mixture of and / structs) instead of returning . We can name them IntoKeys and IntoValues and they can be responsible of implementing the trait. I feel like performance wise they are same, since map and custom struct both will be evaluated lazily when we iterate over. But there might be a rule to always return a proper type in the rust std code that I don't know. So I think I’m okay implementing either way but wanted to ask just in case. What do you think?
For the public API I would prefer this implemented using dedicated IntoKeys and IntoValues iterator types. They can be implemented internally as wrappers around Map<IntoIter<K, Vif that simplifies things.
Thanks for the answer Created a PR for this and you as a reviewer. Would you mind taking a look at it when you have time?