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