cuviper · GitHub

Feature gate: #![feature(btree_set_entry)]

This is a tracking issue for Entry and entry-like methods on BTreeSet.

Public API

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,
    {...}
}
pub enum Entry<'a, T, A: Allocator + Clone = Global> {
    Occupied(OccupiedEntry<'a, T, A>),
    Vacant(VacantEntry<'a, T, A>),
}
pub struct OccupiedEntry<'a, T, A: Allocator + Clone = Global> {...}
pub struct VacantEntry<'a, T, A: Allocator + Clone = Global> {...}
impl<T: Debug + Ord, A: Allocator + Clone> Debug for Entry<'_, T, A> {...}
impl<T: Debug + Ord, A: Allocator + Clone> Debug for OccupiedEntry<'_, T, A> {...}
impl<T: Debug + Ord, A: Allocator + Clone> Debug for VacantEntry<'_, T, A> {...}
impl<'a, T: Ord, A: Allocator + Clone> Entry<'a, T, A> {
    pub fn insert(self) -> OccupiedEntry<'a, T, A> {...}
    pub fn or_insert(self) {...}
    pub fn get(&self) -> &T {...}
}
impl<'a, T: Ord, A: Allocator + Clone> OccupiedEntry<'a, T, A> {
    pub fn get(&self) -> &T {...}
    pub fn remove(self) -> T {...}
}
impl<'a, T: Ord, A: Allocator + Clone> VacantEntry<'a, T, A> {
    pub fn get(&self) -> &T {...}
    pub fn into_value(self) -> T {...}
    pub fn insert(self) {...}
}

Steps / History

Unresolved Questions

  • None yet.

See also #60896 for HashSet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Read the original on github.com ↗