Struct treap::set::TreapSet [] [src]

pub struct TreapSet<T> {
    // some fields omitted
}

A set based on a randomized treap

Methods

impl<T: Ord> TreapSet<T>

fn new() -> TreapSet<T>

Returns a new empty set.

let mut s = treap::TreapSet::new();
assert_eq!(s.len(), 0);
s.insert(5);

fn len(&self) -> usize

Returns the number of elements in the set.

fn clean(&mut self)

Remove all elements from the set.

fn is_empty(&self) -> bool

Returns true if the set is empty.

fn contains(&self, item: &T) -> bool

Returns true if the item is in the set.

fn insert(&mut self, item: T) -> bool

Add a item to the set. Returns true if the item was not in the set already.

fn remove(&mut self, item: &T) -> bool

Remove a item from the set. Returns true if the item was in the set.