Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upEntry APIs should have or_default for V: Default #44324
Comments
Mark-Simulacrum
added
C-feature-request
T-libs
labels
Sep 4, 2017
This comment has been minimized.
This comment has been minimized.
|
Generally, the way the libs team works is "open a PR if a change is small, open an RFC if a change is big." I'm not on the libs team, but this feels pretty small to me; you already almost have an implementation in the comment! |
This comment has been minimized.
This comment has been minimized.
|
@steveklabnik PR submitted! |
BurntSushi
added
the
B-unstable
label
Sep 11, 2017
bors
added a commit
that referenced
this issue
Sep 12, 2017
TimNN
added
the
A-collections
label
Sep 17, 2017
kennytm
referenced this issue
Sep 23, 2017
Closed
.or_insert_default() for collections' Entry #44788
dtolnay
removed
the
C-feature-request
label
Nov 15, 2017
This comment has been minimized.
This comment has been minimized.
|
An unstable |
XAMPPRocky
added
the
C-enhancement
label
Jan 22, 2018
This comment has been minimized.
This comment has been minimized.
|
Is there any reason not to just stabilize this? |
This comment has been minimized.
This comment has been minimized.
|
In Nightly for 6 months, looks good to me to stabilize. @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 17, 2018
•
|
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), 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. |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 19, 2018
|
|
rfcbot
removed
the
proposed-final-comment-period
label
Mar 19, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 29, 2018
|
The final comment period is now complete. |
jonhoo commentedSep 4, 2017
The various Entry APIs (e.g.,
hash_map::Entry,btree_map::Entry) currently haveor_insert, andor_insert_with. However, whenV: Default, I believe they should also have anor_default. This would make it nicer to work with things like maps of maps, maps of lists, etc. While it's true that this is equivalent toor_insert_with(Default::default), I would argue thator_defaultis much more readable.I'd be happy to take a stab at implementing this, but wanted to air the idea first.