Struct std::collections::hashmap::HashSet[src]

pub struct HashSet<T, H = SipHasher> {
    // some fields omitted
}

An implementation of a hash set using the underlying representation of a HashMap where the value is (). As with the HashMap type, a HashSet requires that the elements implement the Eq and Hash traits.

Methods

impl<T: Hash + Eq> HashSet<T, SipHasher>

fn new() -> HashSet<T, SipHasher>

Create an empty HashSet

fn with_capacity(capacity: uint) -> HashSet<T, SipHasher>

Create an empty HashSet with space for at least n elements in the hash table.

impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H>

fn with_hasher(hasher: H) -> HashSet<T, H>

Creates a new empty hash set which will use the given hasher to hash keys.

The hash set is also created with the default initial capacity.

fn with_capacity_and_hasher(capacity: uint, hasher: H) -> HashSet<T, H>

Create an empty HashSet with space for at least capacity elements in the hash table, using hasher to hash the keys.

Warning: hasher is normally randomly generated, and is designed to allow HashSets to be resistant to attacks that cause many collisions and very poor performance. Setting it manually using this function can expose a DoS attack vector.

fn reserve(&mut self, n: uint)

Reserve space for at least n elements in the hash table.

fn contains_equiv<Q: Hash<S> + Equiv<T>>(&self, value: &Q) -> bool

Returns true if the hash set contains a value equivalent to the given query value.

fn iter<'a>(&'a self) -> SetItems<'a, T>

An iterator visiting all elements in arbitrary order. Iterator element type is &'a T.

fn move_iter(self) -> SetMoveItems<T>

Creates a consuming iterator, that is, one that moves each value out of the set in arbitrary order. The set cannot be used after calling this.

fn difference<'a>(&'a self, other: &'a HashSet<T, H>) -> SetAlgebraItems<'a, T, H>

Visit the values representing the difference

fn symmetric_difference<'a>(&'a self, other: &'a HashSet<T, H>) -> Chain<SetAlgebraItems<'a, T, H>, SetAlgebraItems<'a, T, H>>

Visit the values representing the symmetric difference

fn intersection<'a>(&'a self, other: &'a HashSet<T, H>) -> SetAlgebraItems<'a, T, H>

Visit the values representing the intersection

fn union<'a>(&'a self, other: &'a HashSet<T, H>) -> Chain<SetItems<'a, T>, SetAlgebraItems<'a, T, H>>

Visit the values representing the union

Trait Implementations

impl<T: Eq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H>

fn eq(&self, other: &HashSet<T, H>) -> bool

fn ne(&self, other: &Self) -> bool

impl<T: Eq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H>

impl<T: Eq + Hash<S>, S, H: Hasher<S>> Collection for HashSet<T, H>

fn len(&self) -> uint

fn is_empty(&self) -> bool

impl<T: Eq + Hash<S>, S, H: Hasher<S>> Mutable for HashSet<T, H>

fn clear(&mut self)

impl<T: Eq + Hash<S>, S, H: Hasher<S>> Set<T> for HashSet<T, H>

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

fn is_disjoint(&self, other: &HashSet<T, H>) -> bool

fn is_subset(&self, other: &HashSet<T, H>) -> bool

fn is_superset<T>(&self, other: &Self) -> bool

impl<T: Eq + Hash<S>, S, H: Hasher<S>> MutableSet<T> for HashSet<T, H>

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

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

impl<T: Eq + Hash<S> + Show, S, H: Hasher<S>> Show for HashSet<T, H>

fn fmt(&self, f: &mut Formatter) -> Result

impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H>

fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H>

impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Extendable<T> for HashSet<T, H>

fn extend<I: Iterator<T>>(&mut self, iter: I)

impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Default for HashSet<T, H>

fn default() -> HashSet<T, H>

Derived Implementations

impl<T: Clone, H: Clone> Clone for HashSet<T, H>

fn clone(&self) -> HashSet<T, H>

fn clone_from(&mut self, source: &Self)