mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	 132fcd89b3
			
		
	
	
		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