edlang/hashbrown/hash_table/struct.HashTable.html

587 lines
107 KiB
HTML
Raw Normal View History

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Low-level hash table with explicit hashing."><title>HashTable in hashbrown::hash_table - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="hashbrown" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.1 (7cf61ebde 2024-03-27)" data-channel="1.77.1" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../hashbrown/index.html">hashbrown</a><span class="version">0.14.3</span></h2></div><h2 class="location"><a href="#">HashTable</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.allocator">allocator</a></li><li><a href="#method.capacity">capacity</a></li><li><a href="#method.clear">clear</a></li><li><a href="#method.drain">drain</a></li><li><a href="#method.entry">entry</a></li><li><a href="#method.extract_if">extract_if</a></li><li><a href="#method.find">find</a></li><li><a href="#method.find_entry">find_entry</a></li><li><a href="#method.find_mut">find_mut</a></li><li><a href="#method.get_many_mut">get_many_mut</a></li><li><a href="#method.get_many_unchecked_mut">get_many_unchecked_mut</a></li><li><a href="#method.insert_unique">insert_unique</a></li><li><a href="#method.is_empty">is_empty</a></li><li><a href="#method.iter">iter</a></li><li><a href="#method.iter_mut">iter_mut</a></li><li><a href="#method.len">len</a></li><li><a href="#method.new">new</a></li><li><a href="#method.new_in">new_in</a></li><li><a href="#method.reserve">reserve</a></li><li><a href="#method.retain">retain</a></li><li><a href="#method.shrink_to">shrink_to</a></li><li><a href="#method.shrink_to_fit">shrink_to_fit</a></li><li><a href="#method.try_reserve">try_reserve</a></li><li><a href="#method.with_capacity">with_capacity</a></li><li><a href="#method.with_capacity_in">with_capacity_in</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-HashTable%3CT,+A%3E">Clone</a></li><li><a href="#impl-Debug-for-HashTable%3CT,+A%3E">Debug</a></li><li
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../hashbrown/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">hashbrown</a>::<wbr><a href="index.html">hash_table</a>::<wbr><a class="struct" href="#">HashTable</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/hashbrown/table.rs.html#45-50">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct HashTable&lt;T, A = Global&gt;<div class="where">where
A: Allocator,</div>{ <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Low-level hash table with explicit hashing.</p>
<p>The primary use case for this type over <a href="../hash_map/struct.HashMap.html" title="struct hashbrown::hash_map::HashMap"><code>HashMap</code></a> or <a href="../hash_set/struct.HashSet.html" title="struct hashbrown::hash_set::HashSet"><code>HashSet</code></a> is to
support types that do not implement the <a href="https://doc.rust-lang.org/1.77.1/core/hash/macros/derive.Hash.html" title="derive core::hash::macros::Hash"><code>Hash</code></a> and <a href="https://doc.rust-lang.org/1.77.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq"><code>Eq</code></a> traits, but
instead require additional data not contained in the key itself to compute a
hash and compare two elements for equality.</p>
<p>Examples of when this can be useful include:</p>
<ul>
<li>An <code>IndexMap</code> implementation where indices into a <code>Vec</code> are stored as
elements in a <code>HashTable&lt;usize&gt;</code>. Hashing and comparing the elements
requires indexing the associated <code>Vec</code> to get the actual value referred to
by the index.</li>
<li>Avoiding re-computing a hash when it is already known.</li>
<li>Mutating the key of an element in a way that doesnt affect its hash.</li>
</ul>
<p>To achieve this, <code>HashTable</code> methods that search for an element in the table
require a hash value and equality function to be explicitly passed in as
arguments. The method will then iterate over the elements with the given
hash and call the equality function on each of them, until a match is found.</p>
<p>In most cases, a <code>HashTable</code> will not be exposed directly in an API. It will
instead be wrapped in a helper type which handles the work of calculating
hash values and comparing elements.</p>
<p>Due to its low-level nature, this type provides fewer guarantees than
<a href="../hash_map/struct.HashMap.html" title="struct hashbrown::hash_map::HashMap"><code>HashMap</code></a> and <a href="../hash_set/struct.HashSet.html" title="struct hashbrown::hash_set::HashSet"><code>HashSet</code></a>. Specifically, the API allows you to shoot
yourself in the foot by having multiple elements with identical keys in the
table. The table itself will still function correctly and lookups will
arbitrarily return one of the matching elements. However you should avoid
doing this because it changes the runtime of hash table operations from
<code>O(1)</code> to <code>O(k)</code> where <code>k</code> is the number of duplicate entries.</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-HashTable%3CT%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#52-90">source</a><a href="#impl-HashTable%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, Global&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#66-70">source</a><h4 class="code-header">pub const fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Creates an empty <code>HashTable</code>.</p>
<p>The hash table is initially created with a capacity of 0, so it will not allocate until it
is first inserted into.</p>
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>hashbrown::HashTable;
<span class="kw">let </span><span class="kw-2">mut </span>table: HashTable&lt;<span class="kw-2">&amp;</span>str&gt; = HashTable::new();
<span class="macro">assert_eq!</span>(table.len(), <span class="number">0</span>);
<span class="macro">assert_eq!</span>(table.capacity(), <span class="number">0</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_capacity" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#85-89">source</a><h4 class="code-header">pub fn <a href="#method.with_capacity" class="fn">with_capacity</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates an empty <code>HashTable</code> with the specified capacity.</p>
<p>The hash table will be able to hold at least <code>capacity</code> elements without
reallocating. If <code>capacity</code> is 0, the hash table will not allocate.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>hashbrown::HashTable;
<span class="kw">let </span><span class="kw-2">mut </span>table: HashTable&lt;<span class="kw-2">&amp;</span>str&gt; = HashTable::with_capacity(<span class="number">10</span>);
<span class="macro">assert_eq!</span>(table.len(), <span class="number">0</span>);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">10</span>);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#92-1016">source</a><a href="#impl-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: Allocator,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new_in" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#134-138">source</a><h4 class="code-header">pub const fn <a href="#method.new_in" class="fn">new_in</a>(alloc: A) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates an empty <code>HashTable</code> using the given allocator.</p>
<p>The hash table is initially created with a capacity of 0, so it will not allocate until it
is first inserted into.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>bumpalo::Bump;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span>bump = Bump::new();
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new_in(<span class="kw-2">&amp;</span>bump);
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="comment">// The created HashTable holds none elements
</span><span class="macro">assert_eq!</span>(table.len(), <span class="number">0</span>);
<span class="comment">// The created HashTable also doesn't allocate memory
</span><span class="macro">assert_eq!</span>(table.capacity(), <span class="number">0</span>);
<span class="comment">// Now we insert element inside created HashTable
</span>table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"One"</span>), <span class="string">"One"</span>, hasher);
<span class="comment">// We can see that the HashTable holds 1 element
</span><span class="macro">assert_eq!</span>(table.len(), <span class="number">1</span>);
<span class="comment">// And it also allocates some capacity
</span><span class="macro">assert!</span>(table.capacity() &gt; <span class="number">1</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_capacity_in" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#183-187">source</a><h4 class="code-header">pub fn <a href="#method.with_capacity_in" class="fn">with_capacity_in</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>, alloc: A) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates an empty <code>HashTable</code> with the specified capacity using the given allocator.</p>
<p>The hash table will be able to hold at least <code>capacity</code> elements without
reallocating. If <code>capacity</code> is 0, the hash table will not allocate.</p>
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>bumpalo::Bump;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span>bump = Bump::new();
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::with_capacity_in(<span class="number">5</span>, <span class="kw-2">&amp;</span>bump);
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="comment">// The created HashTable holds none elements
</span><span class="macro">assert_eq!</span>(table.len(), <span class="number">0</span>);
<span class="comment">// But it can hold at least 5 elements without reallocating
</span><span class="kw">let </span>empty_map_capacity = table.capacity();
<span class="macro">assert!</span>(empty_map_capacity &gt;= <span class="number">5</span>);
<span class="comment">// Now we insert some 5 elements inside created HashTable
</span>table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"One"</span>), <span class="string">"One"</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"Two"</span>), <span class="string">"Two"</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"Three"</span>), <span class="string">"Three"</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"Four"</span>), <span class="string">"Four"</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"Five"</span>), <span class="string">"Five"</span>, hasher);
<span class="comment">// We can see that the HashTable holds 5 elements
</span><span class="macro">assert_eq!</span>(table.len(), <span class="number">5</span>);
<span class="comment">// But its capacity isn't changed
</span><span class="macro">assert_eq!</span>(table.capacity(), empty_map_capacity)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allocator" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#190-192">source</a><h4 class="code-header">pub fn <a href="#method.allocator" class="fn">allocator</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;A</a></h4></section></summary><div class="docblock"><p>Returns a reference to the underlying allocator.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#224-226">source</a><h4 class="code-header">pub fn <a href="#method.find" class="fn">find</a>(&amp;self, hash: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>, eq: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a reference to an entry in the table with the given hash and
which satisfies the equality function passed.</p>
<p>This method will call <code>eq</code> for all entries with the given hash, but may
also call it for entries with a different hash. <code>eq</code> should only return
true for the desired entry, at which point the search is stopped.</p>
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="number">2</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">3</span>), <span class="number">3</span>, hasher);
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), |<span class="kw-2">&amp;</span>val| val == <span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">4</span>), |<span class="kw-2">&amp;</span>val| val == <span class="number">4</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_mut" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#263-265">source</a><h4 class="code-header">pub fn <a href="#method.find_mut" class="fn">find_mut</a>(
&amp;mut self,
hash: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>,
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable reference to an entry in the table with the given hash
and which satisfies the equality function passed.</p>
<p>This method will call <code>eq</code> for all entries with the given hash, but may
also call it for entries with a different hash. <code>eq</code> should only return
true for the desired entry, at which point the search is stopped.</p>
<p>When mutating an entry, you should ensure that it still retains the same
hash value as when it was inserted, otherwise lookups of that entry may
fail to find it.</p>
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), (<span class="number">1</span>, <span class="string">"a"</span>), |val| hasher(<span class="kw-2">&amp;</span>val.<span class="number">0</span>));
<span class="kw">if let </span><span class="prelude-val">Some</span>(val) = table.find_mut(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>) {
val.<span class="number">1 </span>= <span class="string">"b"</span>;
}
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="string">"b"</span>)));
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), |val| val.<span class="number">0 </span>== <span class="number">2</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_entry" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#301-314">source</a><h4 class="code-header">pub fn <a href="#method.find_entry" class="fn">find_entry</a>(
&amp;mut self,
hash: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>,
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.OccupiedEntry.html" title="struct hashbrown::hash_table::OccupiedEntry">OccupiedEntry</a>&lt;'_, T, A&gt;, <a class="struct" href="struct.AbsentEntry.html" title="struct hashbrown::hash_table::AbsentEntry">AbsentEntry</a>&lt;'_, T, A&gt;&gt;</h4></section></summary><div class="docblock"><p>Returns an <code>OccupiedEntry</code> for an entry in the table with the given hash
and which satisfies the equality function passed.</p>
<p>This can be used to remove the entry from the table. Call
<a href="struct.HashTable.html#method.entry" title="method hashbrown::hash_table::HashTable::entry"><code>HashTable::entry</code></a> instead if you wish to insert an entry if the
lookup fails.</p>
<p>This method will call <code>eq</code> for all entries with the given hash, but may
also call it for entries with a different hash. <code>eq</code> should only return
true for the desired entry, at which point the search is stopped.</p>
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), (<span class="number">1</span>, <span class="string">"a"</span>), |val| hasher(<span class="kw-2">&amp;</span>val.<span class="number">0</span>));
<span class="kw">if let </span><span class="prelude-val">Ok</span>(entry) = table.find_entry(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>) {
entry.remove();
}
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.entry" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#361-379">source</a><h4 class="code-header">pub fn <a href="#method.entry" class="fn">entry</a>(
&amp;mut self,
hash: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>,
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>,
hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>
) -&gt; <a class="enum" href="enum.Entry.html" title="enum hashbrown::hash_table::Entry">Entry</a>&lt;'_, T, A&gt;</h4></section></summary><div class="docblock"><p>Returns an <code>Entry</code> for an entry in the table with the given hash
and which satisfies the equality function passed.</p>
<p>This can be used to remove the entry from the table, or insert a new
entry with the given hash if one doesnt already exist.</p>
<p>This method will call <code>eq</code> for all entries with the given hash, but may
also call it for entries with a different hash. <code>eq</code> should only return
true for the desired entry, at which point the search is stopped.</p>
<p>This method may grow the table in preparation for an insertion. Call
<a href="struct.HashTable.html#method.find_entry" title="method hashbrown::hash_table::HashTable::find_entry"><code>HashTable::find_entry</code></a> if this is undesirable.</p>
<p><code>hasher</code> is called if entries need to be moved or copied to a new table.
This must return the same hash value that each entry was inserted with.</p>
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::hash_table::Entry;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), (<span class="number">1</span>, <span class="string">"a"</span>), |val| hasher(<span class="kw-2">&amp;</span>val.<span class="number">0</span>));
<span class="kw">if let </span>Entry::Occupied(entry) = table.entry(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>, |val| hasher(<span class="kw-2">&amp;</span>val.<span class="number">0</span>))
{
entry.remove();
}
<span class="kw">if let </span>Entry::Vacant(entry) = table.entry(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), |val| val.<span class="number">0 </span>== <span class="number">2</span>, |val| hasher(<span class="kw-2">&amp;</span>val.<span class="number">0</span>)) {
entry.insert((<span class="number">2</span>, <span class="string">"b"</span>));
}
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), |val| val.<span class="number">0 </span>== <span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>(<span class="number">2</span>, <span class="string">"b"</span>)));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_unique" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#407-419">source</a><h4 class="code-header">pub fn <a href="#method.insert_unique" class="fn">insert_unique</a>(
&amp;mut self,
hash: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>,
value: T,
hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>
) -&gt; <a class="struct" href="struct.OccupiedEntry.html" title="struct hashbrown::hash_table::OccupiedEntry">OccupiedEntry</a>&lt;'_, T, A&gt;</h4></section></summary><div class="docblock"><p>Inserts an element into the <code>HashTable</code> with the given hash value, but
without checking whether an equivalent element already exists within the
table.</p>
<p><code>hasher</code> is called if entries need to be moved or copied to a new table.
This must return the same hash value that each entry was inserted with.</p>
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>v = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
v.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#444-446">source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Clears the table, removing all values.</p>
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>v = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
v.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
v.clear();
<span class="macro">assert!</span>(v.is_empty());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to_fit" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#478-480">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit" class="fn">shrink_to_fit</a>(&amp;mut self, hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>)</h4></section></summary><div class="docblock"><p>Shrinks the capacity of the table 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.</p>
<p><code>hasher</code> is called if entries need to be moved or copied to a new table.
This must return the same hash value that each entry was inserted with.</p>
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::with_capacity(<span class="number">100</span>);
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="number">2</span>, hasher);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">100</span>);
table.shrink_to_fit(hasher);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">2</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#517-519">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to" class="fn">shrink_to</a>(&amp;mut self, min_capacity: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>, hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>)</h4></section></summary><div class="docblock"><p>Shrinks the capacity of the table 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.</p>
<p><code>hasher</code> is called if entries need to be moved or copied to a new table.
This must return the same hash value that each entry was inserted with.</p>
<p>Panics if the current capacity is smaller than the supplied
minimum capacity.</p>
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::with_capacity(<span class="number">100</span>);
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="number">2</span>, hasher);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">100</span>);
table.shrink_to(<span class="number">10</span>, hasher);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">10</span>);
table.shrink_to(<span class="number">0</span>, hasher);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">2</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#557-559">source</a><h4 class="code-header">pub fn <a href="#method.reserve" class="fn">reserve</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>, hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>)</h4></section></summary><div class="docblock"><p>Reserves capacity for at least <code>additional</code> more elements to be inserted
in the <code>HashTable</code>. The collection may reserve more space to avoid
frequent reallocations.</p>
<p><code>hasher</code> is called if entries need to be moved or copied to a new table.
This must return the same hash value that each entry was inserted with.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>Panics if the new capacity exceeds <a href="https://doc.rust-lang.org/std/primitive.isize.html"><code>isize::MAX</code></a> bytes and <a href="https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html"><code>abort</code></a> the program
in case of allocation error. Use <a href="struct.HashTable.html#method.try_reserve" title="method hashbrown::hash_table::HashTable::try_reserve"><code>try_reserve</code></a> instead
if you want to handle memory allocation failure.</p>
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table: HashTable&lt;i32&gt; = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.reserve(<span class="number">10</span>, hasher);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">10</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_reserve" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#594-600">source</a><h4 class="code-header">pub fn <a href="#method.try_reserve" class="fn">try_reserve</a>(
&amp;mut self,
additional: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>,
hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.unit.html">()</a>, <a class="enum" href="../enum.TryReserveError.html" title="enum hashbrown::TryReserveError">TryReserveError</a>&gt;</h4></section></summary><div class="docblock"><p>Tries to reserve capacity for at least <code>additional</code> more elements to be inserted
in the given <code>HashTable</code>. The collection may reserve more space to avoid
frequent reallocations.</p>
<p><code>hasher</code> is called if entries need to be moved or copied to a new table.
This must return the same hash value that each entry was inserted with.</p>
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
<p>If the capacity overflows, or the allocator reports a failure, then an error
is returned.</p>
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table: HashTable&lt;i32&gt; = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table
.try_reserve(<span class="number">10</span>, hasher)
.expect(<span class="string">"why is the test harness OOMing on 10 bytes?"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.capacity" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#611-613">source</a><h4 class="code-header">pub fn <a href="#method.capacity" class="fn">capacity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of elements the table can hold without reallocating.</p>
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>hashbrown::HashTable;
<span class="kw">let </span>table: HashTable&lt;i32&gt; = HashTable::with_capacity(<span class="number">100</span>);
<span class="macro">assert!</span>(table.capacity() &gt;= <span class="number">100</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#638-640">source</a><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of elements in the table.</p>
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">let </span><span class="kw-2">mut </span>v = HashTable::new();
<span class="macro">assert_eq!</span>(v.len(), <span class="number">0</span>);
v.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
<span class="macro">assert_eq!</span>(v.len(), <span class="number">1</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#665-667">source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the set contains no elements.</p>
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">let </span><span class="kw-2">mut </span>v = HashTable::new();
<span class="macro">assert!</span>(v.is_empty());
v.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
<span class="macro">assert!</span>(!v.is_empty());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#697-702">source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&amp;self) -&gt; <a class="struct" href="struct.Iter.html" title="struct hashbrown::hash_table::Iter">Iter</a>&lt;'_, T&gt; <a href="#" class="tooltip" data-notable-ty="Iter&lt;&#39;_, T&gt;"></a></h4></section></summary><div class="docblock"><p>An iterator visiting all elements in arbitrary order.
The iterator element type is <code>&amp;'a T</code>.</p>
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"a"</span>), <span class="string">"b"</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="string">"b"</span>), <span class="string">"b"</span>, hasher);
<span class="comment">// Will print in an arbitrary order.
</span><span class="kw">for </span>x <span class="kw">in </span>table.iter() {
<span class="macro">println!</span>(<span class="string">"{}"</span>, x);
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter_mut" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#749-754">source</a><h4 class="code-header">pub fn <a href="#method.iter_mut" class="fn">iter_mut</a>(&amp;mut self) -&gt; <a class="struct" href="struct.IterMut.html" title="struct hashbrown::hash_table::IterMut">IterMut</a>&lt;'_, T&gt; <a href="#" class="tooltip" data-notable-ty="IterMut&lt;&#39;_, T&gt;"></a></h4></section></summary><div class="docblock"><p>An iterator visiting all elements in arbitrary order,
with mutable references to the elements.
The iterator element type is <code>&amp;'a mut T</code>.</p>
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="number">1</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="number">2</span>, hasher);
table.insert_unique(hasher(<span class="kw-2">&amp;</span><span class="number">3</span>), <span class="number">3</span>, hasher);
<span class="comment">// Update all values
</span><span class="kw">for </span>val <span class="kw">in </span>table.iter_mut() {
<span class="kw-2">*</span>val <span class="kw-2">*</span>= <span class="number">2</span>;
}
<span class="macro">assert_eq!</span>(table.len(), <span class="number">3</span>);
<span class="kw">let </span><span class="kw-2">mut </span>vec: Vec&lt;i32&gt; = Vec::new();
<span class="kw">for </span>val <span class="kw">in </span><span class="kw-2">&amp;</span>table {
<span class="macro">println!</span>(<span class="string">"val: {}"</span>, val);
vec.push(<span class="kw-2">*</span>val);
}
<span class="comment">// The `Iter` iterator produces items in arbitrary order, so the
// items must be sorted to test them against a sorted array.
</span>vec.sort_unstable();
<span class="macro">assert_eq!</span>(vec, [<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>]);
<span class="macro">assert_eq!</span>(table.len(), <span class="number">3</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.retain" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#783-792">source</a><h4 class="code-header">pub fn <a href="#method.retain" class="fn">retain</a>(&amp;mut self, f: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Retains only the elements specified by the predicate.</p>
<p>In other words, remove all elements <code>e</code> such that <code>f(&amp;e)</code> returns <code>false</code>.</p>
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">for </span>x <span class="kw">in </span><span class="number">1</span>..=<span class="number">6 </span>{
table.insert_unique(hasher(<span class="kw-2">&amp;</span>x), x, hasher);
}
table.retain(|<span class="kw-2">&amp;mut </span>x| x % <span class="number">2 </span>== <span class="number">0</span>);
<span class="macro">assert_eq!</span>(table.len(), <span class="number">3</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.drain" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#825-829">source</a><h4 class="code-header">pub fn <a href="#method.drain" class="fn">drain</a>(&amp;mut self) -&gt; <a class="struct" href="struct.Drain.html" title="struct hashbrown::hash_table::Drain">Drain</a>&lt;'_, T, A&gt; <a href="#" class="tooltip" data-notable-ty="Drain&lt;&#39;_, T, A&gt;"></a></h4></section></summary><div class="docblock"><p>Clears the set, returning all elements in an iterator.</p>
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">for </span>x <span class="kw">in </span><span class="number">1</span>..=<span class="number">3 </span>{
table.insert_unique(hasher(<span class="kw-2">&amp;</span>x), x, hasher);
}
<span class="macro">assert!</span>(!table.is_empty());
<span class="comment">// print 1, 2, 3 in an arbitrary order
</span><span class="kw">for </span>i <span class="kw">in </span>table.drain() {
<span class="macro">println!</span>(<span class="string">"{}"</span>, i);
}
<span class="macro">assert!</span>(table.is_empty());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.extract_if" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#873-884">source</a><h4 class="code-header">pub fn <a href="#method.extract_if" class="fn">extract_if</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="struct" href="struct.ExtractIf.html" title="struct hashbrown::hash_table::ExtractIf">ExtractIf</a>&lt;'_, T, F, A&gt; <a href="#" class="tooltip" data-notable-ty="ExtractIf&lt;&#39;_, T, F, A&gt;"></a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Drains elements which are true under the given predicate,
and returns an iterator over the removed items.</p>
<p>In other words, move all elements <code>e</code> such that <code>f(&amp;e)</code> returns <code>true</code> out
into another iterator.</p>
<p>If the returned <code>ExtractIf</code> is not exhausted, e.g. because it is dropped without iterating
or the iteration short-circuits, then the remaining elements will be retained.
Use <a href="struct.HashTable.html#method.retain" title="method hashbrown::hash_table::HashTable::retain"><code>retain()</code></a> with a negated predicate if you do not need the returned iterator.</p>
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">for </span>x <span class="kw">in </span><span class="number">0</span>..<span class="number">8 </span>{
table.insert_unique(hasher(<span class="kw-2">&amp;</span>x), x, hasher);
}
<span class="kw">let </span>drained: Vec&lt;i32&gt; = table.extract_if(|<span class="kw-2">&amp;mut </span>v| v % <span class="number">2 </span>== <span class="number">0</span>).collect();
<span class="kw">let </span><span class="kw-2">mut </span>evens = drained.into_iter().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;();
<span class="kw">let </span><span class="kw-2">mut </span>odds = table.into_iter().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;();
evens.sort();
odds.sort();
<span class="macro">assert_eq!</span>(evens, <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>]);
<span class="macro">assert_eq!</span>(odds, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">7</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_many_mut" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#939-945">source</a><h4 class="code-header">pub fn <a href="#method.get_many_mut" class="fn">get_many_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
hashes: [<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.array.html">N</a>],
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a>; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.array.html">N</a>]&gt;</h4></section></summary><div class="docblock"><p>Attempts to get mutable references to <code>N</code> values in the map at once.</p>
<p>The <code>eq</code> argument should be a closure such that <code>eq(i, k)</code> returns true if <code>k</code> is equal to
the <code>i</code>th key to be looked up.</p>
<p>Returns an array of length <code>N</code> with the results of each query. For soundness, at most one
mutable reference will be returned to any value. <code>None</code> will be returned if any of the
keys are duplicates or missing.</p>
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::hash_table::Entry;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>libraries: HashTable&lt;(<span class="kw-2">&amp;</span>str, u32)&gt; = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">for </span>(k, v) <span class="kw">in </span>[
(<span class="string">"Bodleian Library"</span>, <span class="number">1602</span>),
(<span class="string">"Athenæum"</span>, <span class="number">1807</span>),
(<span class="string">"Herzogin-Anna-Amalia-Bibliothek"</span>, <span class="number">1691</span>),
(<span class="string">"Library of Congress"</span>, <span class="number">1800</span>),
] {
libraries.insert_unique(hasher(<span class="kw-2">&amp;</span>k), (k, v), |(k, <span class="kw">_</span>)| hasher(<span class="kw-2">&amp;</span>k));
}
<span class="kw">let </span>keys = [<span class="string">"Athenæum"</span>, <span class="string">"Library of Congress"</span>];
<span class="kw">let </span>got = libraries.get_many_mut(keys.map(|k| hasher(<span class="kw-2">&amp;</span>k)), |i, val| keys[i] == val.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(
got,
<span class="prelude-val">Some</span>([<span class="kw-2">&amp;mut </span>(<span class="string">"Athenæum"</span>, <span class="number">1807</span>), <span class="kw-2">&amp;mut </span>(<span class="string">"Library of Congress"</span>, <span class="number">1800</span>),]),
);
<span class="comment">// Missing keys result in None
</span><span class="kw">let </span>keys = [<span class="string">"Athenæum"</span>, <span class="string">"New York Public Library"</span>];
<span class="kw">let </span>got = libraries.get_many_mut(keys.map(|k| hasher(<span class="kw-2">&amp;</span>k)), |i, val| keys[i] == val.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(got, <span class="prelude-val">None</span>);
<span class="comment">// Duplicate keys result in None
</span><span class="kw">let </span>keys = [<span class="string">"Athenæum"</span>, <span class="string">"Athenæum"</span>];
<span class="kw">let </span>got = libraries.get_many_mut(keys.map(|k| hasher(<span class="kw-2">&amp;</span>k)), |i, val| keys[i] == val.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(got, <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_many_unchecked_mut" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1009-1015">source</a><h4 class="code-header">pub unsafe fn <a href="#method.get_many_unchecked_mut" class="fn">get_many_unchecked_mut</a>&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>&gt;(
&amp;mut self,
hashes: [<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.u64.html">u64</a>; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.array.html">N</a>],
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.bool.html">bool</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a>; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.array.html">N</a>]&gt;</h4></section></summary><div class="docblock"><p>Attempts to get mutable references to <code>N</code> values in the map at once, without validating that
the values are unique.</p>
<p>The <code>eq</code> argument should be a closure such that <code>eq(i, k)</code> returns true if <code>k</code> is equal to
the <code>i</code>th key to be looked up.</p>
<p>Returns an array of length <code>N</code> with the results of each query. <code>None</code> will be returned if
any of the keys are missing.</p>
<p>For a safe alternative see <a href="struct.HashTable.html#method.get_many_mut" title="method hashbrown::hash_table::HashTable::get_many_mut"><code>get_many_mut</code></a>.</p>
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
<p>Calling this method with overlapping keys is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em> even if the resulting
references are not used.</p>
<h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>ahash::AHasher;
<span class="kw">use </span>hashbrown::hash_table::Entry;
<span class="kw">use </span>hashbrown::HashTable;
<span class="kw">use </span>std::hash::{BuildHasher, BuildHasherDefault};
<span class="kw">let </span><span class="kw-2">mut </span>libraries: HashTable&lt;(<span class="kw-2">&amp;</span>str, u32)&gt; = HashTable::new();
<span class="kw">let </span>hasher = BuildHasherDefault::&lt;AHasher&gt;::default();
<span class="kw">let </span>hasher = |val: <span class="kw-2">&amp;</span><span class="kw">_</span>| hasher.hash_one(val);
<span class="kw">for </span>(k, v) <span class="kw">in </span>[
(<span class="string">"Bodleian Library"</span>, <span class="number">1602</span>),
(<span class="string">"Athenæum"</span>, <span class="number">1807</span>),
(<span class="string">"Herzogin-Anna-Amalia-Bibliothek"</span>, <span class="number">1691</span>),
(<span class="string">"Library of Congress"</span>, <span class="number">1800</span>),
] {
libraries.insert_unique(hasher(<span class="kw-2">&amp;</span>k), (k, v), |(k, <span class="kw">_</span>)| hasher(<span class="kw-2">&amp;</span>k));
}
<span class="kw">let </span>keys = [<span class="string">"Athenæum"</span>, <span class="string">"Library of Congress"</span>];
<span class="kw">let </span>got = libraries.get_many_mut(keys.map(|k| hasher(<span class="kw-2">&amp;</span>k)), |i, val| keys[i] == val.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(
got,
<span class="prelude-val">Some</span>([<span class="kw-2">&amp;mut </span>(<span class="string">"Athenæum"</span>, <span class="number">1807</span>), <span class="kw-2">&amp;mut </span>(<span class="string">"Library of Congress"</span>, <span class="number">1800</span>),]),
);
<span class="comment">// Missing keys result in None
</span><span class="kw">let </span>keys = [<span class="string">"Athenæum"</span>, <span class="string">"New York Public Library"</span>];
<span class="kw">let </span>got = libraries.get_many_mut(keys.map(|k| hasher(<span class="kw-2">&amp;</span>k)), |i, val| keys[i] == val.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(got, <span class="prelude-val">None</span>);
<span class="comment">// Duplicate keys result in None
</span><span class="kw">let </span>keys = [<span class="string">"Athenæum"</span>, <span class="string">"Athenæum"</span>];
<span class="kw">let </span>got = libraries.get_many_mut(keys.map(|k| hasher(<span class="kw-2">&amp;</span>k)), |i, val| keys[i] == val.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(got, <span class="prelude-val">None</span>);</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1067-1077">source</a><a href="#impl-Clone-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
A: Allocator + <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1072-1076">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; Self</h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.1/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1079-1087">source</a><a href="#impl-Debug-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
A: Allocator,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1084-1086">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.77.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.77.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.77.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1056-1065">source</a><a href="#impl-Default-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: Allocator + <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1060-1064">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.77.1/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1032-1042">source</a><a href="#impl-IntoIterator-for-%26HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &amp;'a <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: Allocator,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item-2" class="associatedtype trait-impl"><a href="#associatedtype.Item-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;'a T</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter-2" class="associatedtype trait-impl"><a href="#associatedtype.IntoIter-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.Iter.html" title="struct hashbrown::hash_table::Iter">Iter</a>&lt;'a, T&gt;</h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter-2" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1039-1041">source</a><a href="#method.into_iter-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -&gt; <a class="struct" href="struct.Iter.html" title="struct hashbrown::hash_table::Iter">Iter</a>&lt;'a, T&gt; <a href="#" class="tooltip" data-notable-ty="Iter&lt;&#39;a, T&gt;"></a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26mut+HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1044-1054">source</a><a href="#impl-IntoIterator-for-%26mut+HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &amp;'a mut <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: Allocator,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;'a mut T</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.IterMut.html" title="struct hashbrown::hash_table::IterMut">IterMut</a>&lt;'a, T&gt;</h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1051-1053">source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -&gt; <a class="struct" href="struct.IterMut.html" title="struct hashbrown::hash_table::IterMut">IterMut</a>&lt;'a, T&gt; <a href="#" class="tooltip" data-notable-ty="IterMut&lt;&#39;a, T&gt;"></a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-HashTable%3CT,+A%3E" class="impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1018-1030">source</a><a href="#impl-IntoIterator-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: Allocator,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item-1" class="associatedtype trait-impl"><a href="#associatedtype.Item-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = T</h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter-1" class="associatedtype trait-impl"><a href="#associatedtype.IntoIter-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.IntoIter.html" title="struct hashbrown::hash_table::IntoIter">IntoIter</a>&lt;T, A&gt;</h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter-1" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1025-1029">source</a><a href="#method.into_iter-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -&gt; <a class="struct" href="struct.IntoIter.html" title="struct hashbrown::hash_table::IntoIter">IntoIter</a>&lt;T, A&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;T, A&gt;"></a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.77.1/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-HashTable%3CT,+A%3E" class="impl"><a href="#impl-RefUnwindSafe-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-HashTable%3CT,+A%3E" class="impl"><a href="#impl-Send-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-HashTable%3CT,+A%3E" class="impl"><a href="#impl-Sync-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-HashTable%3CT,+A%3E" class="impl"><a href="#impl-Unpin-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-HashTable%3CT,+A%3E" class="impl"><a href="#impl-UnwindSafe-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a>&lt;T, A&gt;<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.77.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.77.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#764">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#767">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#757">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.77.1/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.77.1/core/primitive.reference.html">&amp;mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.77.1/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#804-806">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#811">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#789-791">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.1/src/core/convert/mod.rs.html#796">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"Drain<'_, T, A>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Drain.html\" title=\"struct hashbrown::hash_table::Drain\">Drain</a>&lt;'_, T, A&gt;</code></h3><pre><code><div class=\"where\">impl&lt;T, A: Allocator&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Drain.html\" title=\"struct hashbrown::hash_table::Drain\">Drain</a>&lt;'_, T, A&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","ExtractIf<'_, T, F, A>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.ExtractIf.html\" title=\"struct hashbrown::hash_table::ExtractIf\">ExtractIf</a>&lt;'_, T, F, A&gt;</code></h3><pre><code><div class=\"where\">impl&lt;T, F, A: Allocator&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.ExtractIf.html\" title=\"struct hashbrown::hash_table::ExtractIf\">ExtractIf</a>&lt;'_, T, F, A&gt;<div class=\"where\">where\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.1/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.1/core/primitive.reference.html\">&amp;mut T</a>) -&gt; <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.1/core/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","IntoIter<T, A>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IntoIter.html\" title=\"struct hashbrown::hash_table::IntoIter\">IntoIter</a>&lt;T,