Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TreeSet interface #24

Open
declanvk opened this issue Feb 13, 2023 · 0 comments
Open

Implement TreeSet interface #24

declanvk opened this issue Feb 13, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@declanvk
Copy link
Owner

Like the TreeMap corresponding to BTreeMap, TreeSet should copy BTreeSet where possible.

https://doc.rust-lang.org/stable/std/collections/struct.BTreeSet.html

impl<T> BTreeSet<T> {
    pub const fn new() -> BTreeSet<T>;

    pub fn range<K: ?Sized, R>(&self, range: R) -> Range<'_, T>
    where
        K: Ord,
        T: Borrow<K> + Ord,
        R: RangeBounds<K>;

    pub fn difference<'a>(&'a self, other: &'a BTreeSet<T, A>) -> Difference<'a, T, A>
    where
        T: Ord;

    pub fn symmetric_difference<'a>(
        &'a self,
        other: &'a BTreeSet<T, A>,
    ) -> SymmetricDifference<'a, T>
    where
        T: Ord;

    pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T, A>) -> Intersection<'a, T, A>
    where
        T: Ord;

    pub fn union<'a>(&'a self, other: &'a BTreeSet<T, A>) -> Union<'a, T>
    where
        T: Ord;

    pub fn clear(&mut self)
    where
        A: Clone;

    pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool
    where
        T: Borrow<Q> + Ord,
        Q: Ord;

    pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T>
    where
        T: Borrow<Q> + Ord,
        Q: Ord;

    pub fn is_disjoint(&self, other: &BTreeSet<T, A>) -> bool
    where
        T: Ord;

    pub fn is_subset(&self, other: &BTreeSet<T, A>) -> bool
    where
        T: Ord;

    pub fn is_superset(&self, other: &BTreeSet<T, A>) -> bool
    where
        T: Ord;

    pub fn first(&self) -> Option<&T>
    where
        T: Ord;

    pub fn last(&self) -> Option<&T>
    where
        T: Ord;

    pub fn pop_first(&mut self) -> Option<T>
    where
        T: Ord;

    pub fn pop_last(&mut self) -> Option<T>
    where
        T: Ord;

    pub fn insert(&mut self, value: T) -> bool
    where
        T: Ord;

    pub fn replace(&mut self, value: T) -> Option<T>
    where
        T: Ord;

    pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
    where
        T: Borrow<Q> + Ord,
        Q: Ord;

    pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T>
    where
        T: Borrow<Q> + Ord,
        Q: Ord;

    pub fn retain<F>(&mut self, mut f: F)
    where
        T: Ord,
        F: FnMut(&T) -> bool;

    pub fn append(&mut self, other: &mut Self)
    where
        T: Ord,
        A: Clone;

    pub fn split_off<Q: ?Sized + Ord>(&mut self, value: &Q) -> Self
    where
        T: Borrow<Q> + Ord,
        A: Clone;

    pub fn drain_filter<'a, F>(&'a mut self, pred: F) -> DrainFilter<'a, T, F, A>
    where
        T: Ord,
        F: 'a + FnMut(&T) -> bool;

    pub fn iter(&self) -> Iter<'_, T>;

    pub const fn len(&self) -> usize;

    pub const fn is_empty(&self) -> bool;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant