Why `.insert_entry()` is private for `HashSet` and `BTreeSet` Entry APIs?

VacantEntry and Entry of HashMap and BTreeMap each have a method called .insert_entry().

Methods with this name also exist in the nightly-only experimental Entry APIs of HashSet and BTreeSet. However, these are private, so they can't be called by downstream programmers.

Is there a reason for this difference in APIs, or is this just an accidental inconsistency?

1 Like

My guess from reading the PR review is that it never got updated to look like hash_brown (it took a SemVer bump to make the corresponding change in hash_brown).

pub fn insert(self) -> OccupiedEntry<'a, T, S, A> where ...
// (no `insert_entry`)

Would it be a good idea if I opened a pull request to rust-lang/rust for this?

It should be an API Change Proposal (ACP):

2 Likes

Thanks, ACP filed.

2 Likes