Skip to content

Tracking Issue for or_insert_with_key feature #71024

Closed
@ChaiTRex

Description

@ChaiTRex
Contributor

Steps

Activity

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Apr 11, 2020
jonas-schievink

jonas-schievink commented on Apr 11, 2020

@jonas-schievink
Contributor
* Implementation in `std` (#70966)

That seems like the wrong PR

ChaiTRex

ChaiTRex commented on Apr 11, 2020

@ChaiTRex
ContributorAuthor

@jonas-schievink Thank you. Corrected.

Also, added a 2015 issue that requested this feature so that it can be closed if this is accepted.

added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
on Apr 11, 2020
ChaiTRex

ChaiTRex commented on Apr 12, 2020

@ChaiTRex
ContributorAuthor

Merged into hashbrown (rust-lang/hashbrown#152) and into std as unstable (#70996).

added
Libs-SmallLibs issues that are considered "small" or self-contained
Libs-TrackedLibs issues that are tracked on the team's project board.
on Jul 29, 2020
a1phyr

a1phyr commented on Oct 17, 2020

@a1phyr
Contributor

What does this feature need to be stabilized ?

ChaiTRex

ChaiTRex commented on Oct 19, 2020

@ChaiTRex
ContributorAuthor

This is my first stabilization report, so please let me know if it's insufficient.

Stabilization report

Summary

This allows inserting key-derived values when a HashMap/BTreeMap entry is vacant.

The difference between this and .or_insert_with(|| ... ) is that this provides a reference to the key to the closure after it is moved with .entry(key_being_moved), avoiding the need to copy or clone the key.

Examples

Edge cases

I cannot think of any edge cases.

Stabilization pull request

The stabilization pull request is #78083

added a commit that references this issue on Dec 19, 2020

Rollup merge of rust-lang#78083 - ChaiTRex:master, r=m-ou-se

ce90308

6 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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-SmallLibs issues that are considered "small" or self-containedLibs-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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @m-ou-se@jplatte@jonas-schievink@KodrAus@ChaiTRex

        Issue actions

          Tracking Issue for `or_insert_with_key` feature · Issue #71024 · rust-lang/rust