Closed
Description
The various Entry APIs (e.g., hash_map::Entry
, btree_map::Entry
) currently have or_insert
, and or_insert_with
. However, when V: Default
, I believe they should also have an or_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 to or_insert_with(Default::default)
, I would argue that or_default
is much more readable.
I'd be happy to take a stab at implementing this, but wanted to air the idea first.
Metadata
Metadata
Assignees
Labels
Area: `std::collections`Blocker: Implemented in the nightly compiler and unstable.Category: An issue proposing an enhancement or a PR with one.Relevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.