Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 3 tasks
canova opened this issue Aug 8, 2020 · 8 comments · Fixed by #84328
Closed
1 of 3 tasks

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

canova opened this issue Aug 8, 2020 · 8 comments · Fixed by #84328
Labels
A-collections Area: std::collections. B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@canova
Copy link
Contributor

canova commented Aug 8, 2020

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.
@canova canova added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Aug 8, 2020
@jonas-schievink jonas-schievink added A-collections Area: std::collections. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Aug 8, 2020
@JohnTitor JohnTitor added the B-unstable Blocker: Implemented in the nightly compiler and unstable. label Aug 9, 2020
@KodrAus KodrAus added the Libs-Tracked Libs issues that are tracked on the team's project board. label Sep 10, 2020
@GreenBeard
Copy link

GreenBeard commented Dec 19, 2020

This change will be much appreciated. Could we please also have an into_entries function which returns a tuple of the key, and value?

@jplatte
Copy link
Contributor

jplatte commented Dec 19, 2020

@GreenBeard that's what the into_iter methods do.

@GreenBeard
Copy link

GreenBeard commented Dec 19, 2020

@jplatte For some reason the documentation ( https://doc.rust-lang.org/std/collections/struct.BTreeMap.html ) has that as under "Show hidden undocumented items". Does that mean it was intentionally hidden, or is it an oversight/automatic? I didn't find it when using ctrl+f because of that.

Edit: After further reading it appears that #56073 was really what stopped me from finding it. (I assumed since the expand all kept it hidden that it was intentionally hidden by the author of the code.)

@jplatte
Copy link
Contributor

jplatte commented Dec 19, 2020

@GreenBeard Right, some trait methods are hidden like that. I would generally recommend using the search built into the page rather than the browser's search for rustdoc pages. The method is easy to find if you search for BTreeMap::into_iter. But that's off-topic for this tracking issue.

@m-ou-se
Copy link
Member

m-ou-se commented Apr 19, 2021

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Apr 19, 2021

Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Apr 19, 2021
@rfcbot
Copy link

rfcbot commented Apr 20, 2021

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Apr 30, 2021
@rfcbot
Copy link

rfcbot commented Apr 30, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 5, 2021
…, r=m-ou-se

Stablize {HashMap,BTreeMap}::into_{keys,values}

I would propose to stabilize `{HashMap,BTreeMap}::into_{keys,values}`( aka. `map_into_keys_values`).

Closes rust-lang#75294.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 5, 2021
…, r=m-ou-se

Stablize {HashMap,BTreeMap}::into_{keys,values}

I would propose to stabilize `{HashMap,BTreeMap}::into_{keys,values}`( aka. `map_into_keys_values`).

Closes rust-lang#75294.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 6, 2021
…, r=m-ou-se

Stablize {HashMap,BTreeMap}::into_{keys,values}

I would propose to stabilize `{HashMap,BTreeMap}::into_{keys,values}`( aka. `map_into_keys_values`).

Closes rust-lang#75294.
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 6, 2021
@bors bors closed this as completed in 6a6c644 May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-collections Area: std::collections. B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants