Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub fn values(&self) -> Values<'_, K, V>
An iterator visiting all values in arbitrary order. The iterator element type is &'a V.
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 HashMap. 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 shrink_to_fit(&mut self)
Shrinks the capacity of the map 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 map 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 HashMap. 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 remove_entry<Q>(&mut self, k: &Q) -> Option<(K, V)>
Removes a key from the map, returning the stored key and value if the key was previously in the map.
method std Stable since 1.27.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove<Q>(&mut self, k: &Q) -> Option<V>
Removes a key from the map, returning the value at the key if the key was previously in the map.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn new() -> HashMap<K, V, RandomState>
Creates an empty HashMap.
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 map.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn keys(&self) -> Keys<'_, K, V>
An iterator visiting all keys in arbitrary order. The iterator element type is &'a K.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
An iterator visiting all key-value pairs in arbitrary order, with mutable references to the values. The iterator element type is (&'a K, &'a mut V).
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, K, V>
An iterator visiting all key-value pairs in arbitrary order. The iterator element type is (&'a K, &'a V).
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 map contains no elements.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_values(self) -> IntoValues<K, V, A>
Creates a consuming iterator visiting all the values in arbitrary order. The map cannot be used after calling this. The iterator element type is V.
method std Stable since 1.54.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_keys(self) -> IntoKeys<K, V, A>
Creates a consuming iterator visiting all the keys in arbitrary order. The map cannot be used after calling this. The iterator element type is K.
method std Stable since 1.54.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert(&mut self, k: K, v: V) -> Option<V>
Inserts a key-value pair into the map.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn hasher(&self) -> &S
Returns a reference to the map's BuildHasher.
method std Stable since 1.9.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
Returns the key-value pair corresponding to the supplied key. This is potentially useful:
method std Stable since 1.40.0 Version 1.100.0-nightly
"This is the difference in approaches of the two languages. In C++ if the code is vulnerable, the blame is on the programmer. In Rust if the code is vu..."

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.