Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub struct Intersection<'a, T, S, A>
A lazy iterator producing elements in the intersection of HashSets.
struct std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn with_hasher(hasher: S) -> HashSet<T, S>
Creates a new empty hash set which will use the given hasher to hash keys.
associated_function std Stable since 1.7.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashSet<T, S>
Creates an empty HashSet with at least the specified capacity, using hasher to hash the keys.
associated_function std Stable since 1.7.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_capacity(capacity: usize) -> HashSet<T, RandomState>
Creates an empty HashSet with at least the specified capacity.
associated_function std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn union<'a>(&'a self, other: &'a HashSet<T, S, A>) -> Union<'a, T, S, A>
Visits the values representing the union, i.e., all the values in self or other, without duplicates.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional more elements to be inserted in the HashSet. The collection may reserve more space to speculatively avoid frequent reallocations. After calling try_reserve, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if capacity is already sufficient.
method std Stable since 1.57.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn take<Q>(&mut self, value: &Q) -> Option<T>
Removes and returns the value in the set, if any, that is equal to the given one.
method std Stable since 1.9.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn symmetric_difference<'a>(&'a self, other: &'a HashSet<T, S, A>) -> SymmetricDifference<'a, T, S, A>
Visits the values representing the symmetric difference, i.e., the values that are in self or in other but not in both.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the set as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to(&mut self, min_capacity: usize)
Shrinks the capacity of the set with a lower limit. It will drop down no lower than the supplied limit while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
method std Stable since 1.56.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 std Stable since 1.18.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted in the HashSet. The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.
method std 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 value, if any, that is equal to the given one. Returns the replaced value.
method std Stable since 1.9.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove<Q>(&mut self, value: &Q) -> bool
Removes a value from the set. Returns whether the value was present in the set.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn new() -> HashSet<T, RandomState>
Creates an empty HashSet.
associated_function std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn len(&self) -> usize
Returns the number of elements in the set.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, T>
An iterator visiting all elements in arbitrary order. The iterator element type is &'a T.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_superset(&self, other: &HashSet<T, S, A>) -> bool
Returns true if the set is a superset of another, i.e., self contains at least all the values in other.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_subset(&self, other: &HashSet<T, S, A>) -> bool
Returns true if the set is a subset of another, i.e., other contains at least all the values in self.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_empty(&self) -> bool
Returns true if the set contains no elements.
method std Stable since 1.0.0 Version 1.100.0-nightly
"* Modular * Very high quality construction compared to its competitors * If you leave it lying around forget about it, stepping into a project is pain..."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.