Skip to content

Tracking Issue for {HashMap,BTreeMap}::into_{keys,values} #75294

Closed
@canova

Description

@canova

Feature gate: #![feature(map_into_keys_values)]

This is a tracking issue for {HashMap,BTreeMap}::into_{keys,values}.

Public API

// alloc::collections::btree_map

impl<K, V> BTreeMap<K, V> {
    pub fn into_keys(self) -> IntoKeys<K, V>;
    pub fn into_values(self) -> IntoValues<K, V>;
}

pub struct IntoKeys<K, V>;
pub struct IntoValues<K, V>;

impl<K, V> Iterator for IntoKeys<K, V> { type Item = K; }
impl<K, V> DoubleEndedIterator for IntoKeys<K, V> {}
impl<K, V> ExactSizeIterator for IntoKeys<K, V> {}
impl<K, V> FusedIterator for IntoKeys<K, V> {}
impl<K: Debug, V> Debug for IntoKeys<K, V> {}

impl<K, V> Iterator for IntoValues<K, V> { type Item = V; }
impl<K, V> DoubleEndedIterator for IntoValues<K, V> {}
impl<K, V> ExactSizeIterator for IntoValues<K, V> {}
impl<K, V> FusedIterator for IntoValues<K, V> {}
impl<K, V: Debug> Debug for IntoValues<K, V> {}

// alloc::collections::hash_map

impl<K: Eq + Hash, V, S: BuildHasher> HashMap<K, V, S> {
    pub fn into_keys(self) -> IntoKeys<K, V>;
    pub fn into_values(self) -> IntoValues<K, V>;
}

pub struct IntoKeys<K, V>;
pub struct IntoValues<K, V>;

impl<K, V> Iterator for IntoKeys<K, V> { type Item = K; }
impl<K, V> ExactSizeIterator for IntoKeys<K, V> {}
impl<K, V> FusedIterator for IntoKeys<K, V> {}
impl<K: Debug, V> Debug for IntoKeys<K, V> {}

impl<K, V> Iterator for IntoValues<K, V> { type Item = V; }
impl<K, V> ExactSizeIterator for IntoValues<K, V> {}
impl<K, V> FusedIterator for IntoValues<K, V> {}
impl<K, V: Debug> Debug for IntoValues<K, V> {}

Steps / History

Unresolved Questions

  • None yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections`B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions