mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
132fcd89b3
Add `BTreeSet` entry APIs to match `HashSet`
The following methods are added, along with the corresponding `Entry` implementation.
```rust
impl<T, A: Allocator + Clone> BTreeSet<T, A> {
pub fn get_or_insert(&mut self, value: T) -> &T
where
T: Ord,
{...}
pub fn get_or_insert_with<Q: ?Sized, F>(&mut self, value: &Q, f: F) -> &T
where
T: Borrow<Q> + Ord,
Q: Ord,
F: FnOnce(&Q) -> T,
{...}
pub fn entry(&mut self, value: T) -> Entry<'_, T, A>
where
T: Ord,
{...}
}
```
Tracking issue #133549
Closes https://github.com/rust-lang/rfcs/issues/1490