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

Implement into_keys and into_values for associative maps #75163

Merged
merged 8 commits into from
Aug 8, 2020

Conversation

canova
Copy link
Contributor

@canova canova commented Aug 4, 2020

This PR implements into_keys and into_values for HashMap and BTreeMap types. They are implemented as unstable, under map_into_keys_values feature.
Fixes #55214.
r? @dtolnay

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2020
library/alloc/src/collections/btree/map.rs Outdated Show resolved Hide resolved
library/std/src/collections/hash/map.rs Outdated Show resolved Hide resolved
library/alloc/src/collections/btree/map.rs Outdated Show resolved Hide resolved
library/std/src/collections/hash/map.rs Outdated Show resolved Hide resolved
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me once the IntoValues min and max are fixed. Please also file a tracking issue (separate from the original "feature request" issue) and update the unstable attribute issue numbers in the PR.

@canova
Copy link
Contributor Author

canova commented Aug 8, 2020

Thanks for the review! Filed #75294 as the tracking issue and and change the old number to the new in the patch (added two more commits to address them).

@canova canova requested a review from dtolnay August 8, 2020 15:55
/// use std::collections::HashMap;
///
/// let mut map = HashMap::new();
/// map.insert("a", 1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's better an example with HashMap<String> instead of HashMap<&str> ?

@dtolnay
Copy link
Member

dtolnay commented Aug 8, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Aug 8, 2020

📌 Commit 4cd2637 has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 8, 2020
@bors
Copy link
Contributor

bors commented Aug 8, 2020

⌛ Testing commit 4cd2637 with merge 1facd4a...

@bors
Copy link
Contributor

bors commented Aug 8, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: dtolnay
Pushing 1facd4a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 8, 2020
@bors bors merged commit 1facd4a into rust-lang:master Aug 8, 2020
@@ -1,3 +1,5 @@
// ignore-tidy-filelength
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think IntoKeys and impls should be moved to a module file to remove this tidy ignore.

mwkmwkmwk added a commit to mwkmwkmwk/hashbrown that referenced this pull request Sep 20, 2021
This is pretty much a direct copy of rust-lang/rust#75163, aligning the
hashbrown API with current std API.
mwkmwkmwk added a commit to mwkmwkmwk/hashbrown that referenced this pull request Sep 20, 2021
This is pretty much a direct copy of rust-lang/rust#75163, aligning the
hashbrown API with current std API.
bors added a commit to rust-lang/hashbrown that referenced this pull request Sep 22, 2021
Add into_keys and into_values to HashMap.

This is pretty much a direct copy of rust-lang/rust#75163, aligning the
hashbrown API with current std API.
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add into_keys and into_values to associative maps
7 participants