doc.rust-lang.org
pub fn get<Q>(&self, value: &Q) -> Option<&T>
Returns a reference to the element in the set, if any, that is equal to the value.
method
alloc
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert(&mut self, value: T) -> bool
Adds a value to the set.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T, A>) -> Intersection<'a, T, A>
Visits the elements representing the intersection, i.e., the elements that are both in self and other, in ascending order.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_disjoint(&self, other: &BTreeSet<T, A>) -> bool
Returns true if self has no elements in common with other. This is equivalent to checking for an empty intersection.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_empty(&self) -> bool
Returns true if the set contains no elements.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_subset(&self, other: &BTreeSet<T, A>) -> bool
Returns true if the set is a subset of another, i.e., other contains at least all the elements in self.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_superset(&self, other: &BTreeSet<T, A>) -> bool
Returns true if the set is a superset of another, i.e., self contains at least all the elements in other.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, T>
Gets an iterator that visits the elements in the BTreeSet in ascending order.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn last(&self) -> Option<&T>
Returns a reference to the last element in the set, if any. This element is always the maximum of all elements in the set.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn len(&self) -> usize
Returns the number of elements in the set.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> BTreeSet<T>
Makes a new, empty BTreeSet.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_first(&mut self) -> Option<T>
Removes the first element from the set and returns it, if any. The first element is always the minimum element in the set.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_last(&mut self) -> Option<T>
Removes the last element from the set and returns it, if any. The last element is always the maximum element in the set.
method
alloc
Stable since 1.66.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn range<K, R>(&self, range: R) -> Range<'_, T>
Constructs a double-ended iterator over a sub-range of elements in the set. The simplest way is to use the range syntax min..max, thus range(min..max) will yield elements from min (inclusive) to max (exclusive). The range may also be entered as (Bound<T>, Bound<T>), so for example range((Excluded(4), Included(10))) will yield a left-exclusive, right-inclusive range from 4 to 10.
method
alloc
Stable since 1.17.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove<Q>(&mut self, value: &Q) -> bool
If the set contains an element equal to the value, removes it from the set and drops it. Returns whether such an element was present.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn replace(&mut self, value: T) -> Option<T>
Adds a value to the set, replacing the existing element, if any, that is equal to the value. Returns the replaced element.
method
alloc
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn retain<F>(&mut self, f: F)
Retains only the elements specified by the predicate.
method
alloc
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_off<Q>(&mut self, value: &Q) -> Self
Splits the collection into two at the value. Returns a new collection with all elements greater than or equal to the value.
method
alloc
Stable since 1.11.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T, A>) -> SymmetricDifference<'a, T>
Visits the elements representing the symmetric difference, i.e., the elements that are in self or in other but not in both, in ascending order.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn take<Q>(&mut self, value: &Q) -> Option<T>
Removes and returns the element in the set, if any, that is equal to the value.
method
alloc
Stable since 1.9.0
Version 1.100.0-nightly