Struct collections::treemap::TreeSet
pub struct TreeSet<T> { // some fields omitted }
A implementation of the Set
trait on top of the TreeMap
container. The
only requirement is that the type of the elements contained ascribes to the
TotalOrd
trait.
Methods
impl<T: TotalOrd> TreeSet<T>
fn new() -> TreeSet<T>
Create an empty TreeSet
fn iter<'a>(&'a self) -> SetItems<'a, T>
Get a lazy iterator over the values in the set. Requires that it be frozen (immutable).
fn rev_iter<'a>(&'a self) -> RevSetItems<'a, T>
Get a lazy iterator over the values in the set. Requires that it be frozen (immutable).
fn lower_bound<'a>(&'a self, v: &T) -> SetItems<'a, T>
Get a lazy iterator pointing to the first value not less than v
(greater or equal).
If all elements in the set are less than v
empty iterator is returned.
fn upper_bound<'a>(&'a self, v: &T) -> SetItems<'a, T>
Get a lazy iterator pointing to the first value greater than v
.
If all elements in the set are not greater than v
empty iterator is returned.
fn difference<'a>(&'a self, other: &'a TreeSet<T>) -> DifferenceItems<'a, T>
Visit the values (in-order) representing the difference
fn symmetric_difference<'a>(&'a self, other: &'a TreeSet<T>) -> SymDifferenceItems<'a, T>
Visit the values (in-order) representing the symmetric difference
fn intersection<'a>(&'a self, other: &'a TreeSet<T>) -> IntersectionItems<'a, T>
Visit the values (in-order) representing the intersection
fn union<'a>(&'a self, other: &'a TreeSet<T>) -> UnionItems<'a, T>
Visit the values (in-order) representing the union
Trait Implementations
impl<T: Eq + TotalOrd> Eq for TreeSet<T>
impl<T: Ord + TotalOrd> Ord for TreeSet<T>
fn lt(&self, other: &TreeSet<T>) -> bool
fn le(&self, other: &TreeSet<T>) -> bool
fn ge(&self, other: &TreeSet<T>) -> bool
fn gt(&self, other: &TreeSet<T>) -> bool
impl<T: TotalOrd> Container for TreeSet<T>
fn len(&self) -> uint
Return the number of elements in the set
fn is_empty(&self) -> bool
Return true if the set contains no elements
impl<T: TotalOrd> Mutable for TreeSet<T>
fn clear(&mut self)
Clear the set, removing all values.
impl<T: TotalOrd> Set<T> for TreeSet<T>
fn contains(&self, value: &T) -> bool
Return true if the set contains a value
fn is_disjoint(&self, other: &TreeSet<T>) -> bool
Return true if the set has no elements in common with other
.
This is equivalent to checking for an empty intersection.
fn is_subset(&self, other: &TreeSet<T>) -> bool
Return true if the set is a subset of another
fn is_superset(&self, other: &TreeSet<T>) -> bool
Return true if the set is a superset of another
impl<T: TotalOrd> MutableSet<T> for TreeSet<T>
fn insert(&mut self, value: T) -> bool
Add a value to the set. Return true if the value was not already present in the set.
fn remove(&mut self, value: &T) -> bool
Remove a value from the set. Return true if the value was present in the set.