mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-11 20:57:16 +01:00
631 lines
No EOL
117 KiB
HTML
631 lines
No EOL
117 KiB
HTML
<!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><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.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.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><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.15.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Hash<wbr>Table</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.allocation_size" title="allocation_size">allocation_size</a></li><li><a href="#method.allocator" title="allocator">allocator</a></li><li><a href="#method.capacity" title="capacity">capacity</a></li><li><a href="#method.clear" title="clear">clear</a></li><li><a href="#method.drain" title="drain">drain</a></li><li><a href="#method.entry" title="entry">entry</a></li><li><a href="#method.extract_if" title="extract_if">extract_if</a></li><li><a href="#method.find" title="find">find</a></li><li><a href="#method.find_entry" title="find_entry">find_entry</a></li><li><a href="#method.find_mut" title="find_mut">find_mut</a></li><li><a href="#method.get_many_mut" title="get_many_mut">get_many_mut</a></li><li><a href="#method.get_many_unchecked_mut" title="get_many_unchecked_mut">get_many_unchecked_mut</a></li><li><a href="#method.insert_unique" title="insert_unique">insert_unique</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.iter" title="iter">iter</a></li><li><a href="#method.iter_hash" title="iter_hash">iter_hash</a></li><li><a href="#method.iter_hash_mut" title="iter_hash_mut">iter_hash_mut</a></li><li><a href="#method.iter_mut" title="iter_mut">iter_mut</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.new_in" title="new_in">new_in</a></li><li><a href="#method.reserve" title="reserve">reserve</a></li><li><a href="#method.retain" title="retain">retain</a></li><li><a href="#method.shrink_to" title="shrink_to">shrink_to</a></li><li><a href="#method.shrink_to_fit" title="shrink_to_fit">shrink_to_fit</a></li><li><a href="#method.try_reserve" title="try_reserve">try_reserve</a></li><li><a href="#method.with_capacity" title="with_capacity">with_capacity</a></li><li><a href="#method.with_capacity_in" title="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" title="Clone">Clone</a></li><li><a href="#impl-Debug-for-HashTable%3CT,+A%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-HashTable%3CT,+A%3E" title="Default">Default</a></li><li><a href="#impl-IntoIterator-for-%26HashTable%3CT,+A%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-IntoIterator-for-%26mut+HashTable%3CT,+A%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-IntoIterator-for-HashTable%3CT,+A%3E" title="IntoIterator">IntoIterator</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-HashTable%3CT,+A%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-HashTable%3CT,+A%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-HashTable%3CT,+A%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-HashTable%3CT,+A%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-HashTable%3CT,+A%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-HashTable%3CT,+A%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In hashbrown::<wbr>hash_<wbr>table</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">hashbrown</a>::<wbr><a href="index.html">hash_table</a></span><h1>Struct <span class="struct">HashTable</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/hashbrown/table.rs.html#47-52">source</a> </span></div><pre class="rust item-decl"><code>pub struct HashTable<T, A = Global><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/std/hash/trait.Hash.html"><code>Hash</code></a> and <a href="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><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<usize></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 doesn’t 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#54-92">source</a><a href="#impl-HashTable%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a><T, Global></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#68-72">source</a><h4 class="code-header">pub const fn <a href="#method.new" class="fn">new</a>() -> 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<<span class="kw-2">&</span>str> = 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#87-91">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.83.0/core/primitive.usize.html">usize</a>) -> 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<<span class="kw-2">&</span>str> = 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() >= <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#94-1122">source</a><a href="#impl-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<T, A> <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a><T, A><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#135-139">source</a><h4 class="code-header">pub const fn <a href="#method.new_in" class="fn">new_in</a>(alloc: A) -> 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>bumpalo::Bump;
|
||
<span class="kw">use </span>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<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">&</span>bump);
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</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() > <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.83.0/core/primitive.usize.html">usize</a>, alloc: A) -> 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>bumpalo::Bump;
|
||
<span class="kw">use </span>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<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">&</span>bump);
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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 >= <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">&</span><span class="string">"One"</span>), <span class="string">"One"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"Two"</span>), <span class="string">"Two"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"Three"</span>), <span class="string">"Three"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"Four"</span>), <span class="string">"Four"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&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#223-225">source</a><h4 class="code-header">pub fn <a href="#method.find" class="fn">find</a>(&self, hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>, eq: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>></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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), <span class="number">1</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">2</span>), <span class="number">2</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</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">&</span><span class="number">2</span>), |<span class="kw-2">&</span>val| val == <span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">2</span>));
|
||
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&</span><span class="number">4</span>), |<span class="kw-2">&</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#261-263">source</a><h4 class="code-header">pub fn <a href="#method.find_mut" class="fn">find_mut</a>(
|
||
&mut self,
|
||
hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&mut T</a>></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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), (<span class="number">1</span>, <span class="string">"a"</span>), |val| hasher(<span class="kw-2">&</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">&</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">&</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">&</span>(<span class="number">1</span>, <span class="string">"b"</span>)));
|
||
<span class="macro">assert_eq!</span>(table.find(hasher(<span class="kw-2">&</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#299-312">source</a><h4 class="code-header">pub fn <a href="#method.find_entry" class="fn">find_entry</a>(
|
||
&mut self,
|
||
hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.OccupiedEntry.html" title="struct hashbrown::hash_table::OccupiedEntry">OccupiedEntry</a><'_, T, A>, <a class="struct" href="struct.AbsentEntry.html" title="struct hashbrown::hash_table::AbsentEntry">AbsentEntry</a><'_, T, A>></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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), (<span class="number">1</span>, <span class="string">"a"</span>), |val| hasher(<span class="kw-2">&</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">&</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">&</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#359-377">source</a><h4 class="code-header">pub fn <a href="#method.entry" class="fn">entry</a>(
|
||
&mut self,
|
||
hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a>,
|
||
hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
) -> <a class="enum" href="enum.Entry.html" title="enum hashbrown::hash_table::Entry">Entry</a><'_, T, A></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 doesn’t 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>hashbrown::hash_table::Entry;
|
||
<span class="kw">use </span>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), (<span class="number">1</span>, <span class="string">"a"</span>), |val| hasher(<span class="kw-2">&</span>val.<span class="number">0</span>));
|
||
<span class="kw">if let </span>Entry::Occupied(entry) = table.entry(hasher(<span class="kw-2">&</span><span class="number">1</span>), |val| val.<span class="number">0 </span>== <span class="number">1</span>, |val| hasher(<span class="kw-2">&</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">&</span><span class="number">2</span>), |val| val.<span class="number">0 </span>== <span class="number">2</span>, |val| hasher(<span class="kw-2">&</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">&</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">&</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">&</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#404-416">source</a><h4 class="code-header">pub fn <a href="#method.insert_unique" class="fn">insert_unique</a>(
|
||
&mut self,
|
||
hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
value: T,
|
||
hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
) -> <a class="struct" href="struct.OccupiedEntry.html" title="struct hashbrown::hash_table::OccupiedEntry">OccupiedEntry</a><'_, T, A></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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>v = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
v.insert_unique(hasher(<span class="kw-2">&</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#440-442">source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>v = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
v.insert_unique(hasher(<span class="kw-2">&</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#473-475">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit" class="fn">shrink_to_fit</a>(&mut self, hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<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 = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), <span class="number">1</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">2</span>), <span class="number">2</span>, hasher);
|
||
<span class="macro">assert!</span>(table.capacity() >= <span class="number">100</span>);
|
||
table.shrink_to_fit(hasher);
|
||
<span class="macro">assert!</span>(table.capacity() >= <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#511-513">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to" class="fn">shrink_to</a>(&mut self, min_capacity: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>, hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<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 = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), <span class="number">1</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">2</span>), <span class="number">2</span>, hasher);
|
||
<span class="macro">assert!</span>(table.capacity() >= <span class="number">100</span>);
|
||
table.shrink_to(<span class="number">10</span>, hasher);
|
||
<span class="macro">assert!</span>(table.capacity() >= <span class="number">10</span>);
|
||
table.shrink_to(<span class="number">0</span>, hasher);
|
||
<span class="macro">assert!</span>(table.capacity() >= <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#550-552">source</a><h4 class="code-header">pub fn <a href="#method.reserve" class="fn">reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>, hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table: HashTable<i32> = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.reserve(<span class="number">10</span>, hasher);
|
||
<span class="macro">assert!</span>(table.capacity() >= <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#586-592">source</a><h4 class="code-header">pub fn <a href="#method.try_reserve" class="fn">try_reserve</a>(
|
||
&mut self,
|
||
additional: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>,
|
||
hasher: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.unit.html">()</a>, <a class="enum" href="../enum.TryReserveError.html" title="enum hashbrown::TryReserveError">TryReserveError</a>></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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table: HashTable<i32> = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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#603-605">source</a><h4 class="code-header">pub fn <a href="#method.capacity" class="fn">capacity</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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<i32> = HashTable::with_capacity(<span class="number">100</span>);
|
||
<span class="macro">assert!</span>(table.capacity() >= <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#629-631">source</a><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</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#655-657">source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</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#686-691">source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&self) -> <a class="struct" href="struct.Iter.html" title="struct hashbrown::hash_table::Iter">Iter</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Iter<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>An iterator visiting all elements in arbitrary order.
|
||
The iterator element type is <code>&'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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"a"</span>), <span class="string">"b"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</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#737-742">source</a><h4 class="code-header">pub fn <a href="#method.iter_mut" class="fn">iter_mut</a>(&mut self) -> <a class="struct" href="struct.IterMut.html" title="struct hashbrown::hash_table::IterMut">IterMut</a><'_, T> <a href="#" class="tooltip" data-notable-ty="IterMut<'_, T>">ⓘ</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>&'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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), <span class="number">1</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">2</span>), <span class="number">2</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</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<i32> = Vec::new();
|
||
|
||
<span class="kw">for </span>val <span class="kw">in </span><span class="kw-2">&</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.iter_hash" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#776-781">source</a><h4 class="code-header">pub fn <a href="#method.iter_hash" class="fn">iter_hash</a>(&self, hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>) -> <a class="struct" href="struct.IterHash.html" title="struct hashbrown::hash_table::IterHash">IterHash</a><'_, T> <a href="#" class="tooltip" data-notable-ty="IterHash<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>An iterator visiting all elements which may match a hash.
|
||
The iterator element type is <code>&'a T</code>.</p>
|
||
<p>This iterator may return elements from the table that have a hash value
|
||
different than the one provided. You should always validate the returned
|
||
values before using them.</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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"a"</span>), <span class="string">"a"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"a"</span>), <span class="string">"b"</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="string">"b"</span>), <span class="string">"c"</span>, hasher);
|
||
|
||
<span class="comment">// Will print "a" and "b" (and possibly "c") in an arbitrary order.
|
||
</span><span class="kw">for </span>x <span class="kw">in </span>table.iter_hash(hasher(<span class="kw-2">&</span><span class="string">"a"</span>)) {
|
||
<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_hash_mut" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#829-834">source</a><h4 class="code-header">pub fn <a href="#method.iter_hash_mut" class="fn">iter_hash_mut</a>(&mut self, hash: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>) -> <a class="struct" href="struct.IterHashMut.html" title="struct hashbrown::hash_table::IterHashMut">IterHashMut</a><'_, T> <a href="#" class="tooltip" data-notable-ty="IterHashMut<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>A mutable iterator visiting all elements which may match a hash.
|
||
The iterator element type is <code>&'a mut T</code>.</p>
|
||
<p>This iterator may return elements from the table that have a hash value
|
||
different than the one provided. You should always validate the returned
|
||
values before using them.</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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), <span class="number">2</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">1</span>), <span class="number">3</span>, hasher);
|
||
table.insert_unique(hasher(<span class="kw-2">&</span><span class="number">2</span>), <span class="number">5</span>, hasher);
|
||
|
||
<span class="comment">// Update matching values
|
||
</span><span class="kw">for </span>val <span class="kw">in </span>table.iter_hash_mut(hasher(<span class="kw-2">&</span><span class="number">1</span>)) {
|
||
<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<i32> = Vec::new();
|
||
|
||
<span class="kw">for </span>val <span class="kw">in </span><span class="kw-2">&</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 values will contain 4 and 6 and may contain either 5 or 10.
|
||
</span><span class="macro">assert!</span>(vec.contains(<span class="kw-2">&</span><span class="number">4</span>));
|
||
<span class="macro">assert!</span>(vec.contains(<span class="kw-2">&</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#862-871">source</a><h4 class="code-header">pub fn <a href="#method.retain" class="fn">retain</a>(&mut self, f: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&mut T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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(&e)</code> returns <code>false</code>.</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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</span>x), x, hasher);
|
||
}
|
||
table.retain(|<span class="kw-2">&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#903-907">source</a><h4 class="code-header">pub fn <a href="#method.drain" class="fn">drain</a>(&mut self) -> <a class="struct" href="struct.Drain.html" title="struct hashbrown::hash_table::Drain">Drain</a><'_, T, A> <a href="#" class="tooltip" data-notable-ty="Drain<'_, T, A>">ⓘ</a></h4></section></summary><div class="docblock"><p>Clears the set, returning all elements in an iterator.</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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</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#950-961">source</a><h4 class="code-header">pub fn <a href="#method.extract_if" class="fn">extract_if</a><F>(&mut self, f: F) -> <a class="struct" href="struct.ExtractIf.html" title="struct hashbrown::hash_table::ExtractIf">ExtractIf</a><'_, T, F, A> <a href="#" class="tooltip" data-notable-ty="ExtractIf<'_, T, F, A>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&mut T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/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(&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-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>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>table = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</span>x), x, hasher);
|
||
}
|
||
<span class="kw">let </span>drained: Vec<i32> = table.extract_if(|<span class="kw-2">&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::<Vec<<span class="kw">_</span>>>();
|
||
<span class="kw">let </span><span class="kw-2">mut </span>odds = table.into_iter().collect::<Vec<<span class="kw">_</span>>>();
|
||
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#1041-1047">source</a><h4 class="code-header">pub fn <a href="#method.get_many_mut" class="fn">get_many_mut</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>>(
|
||
&mut self,
|
||
hashes: [<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.array.html">N</a>],
|
||
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a>,
|
||
) -> [<a class="enum" href="https://doc.rust-lang.org/1.83.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&mut T</a>>; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.array.html">N</a>]</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 used if the key is missing.</p>
|
||
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
|
||
<p>Panics if any keys are overlapping.</p>
|
||
<h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>hashbrown::hash_table::Entry;
|
||
<span class="kw">use </span>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>libraries: HashTable<(<span class="kw-2">&</span>str, u32)> = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</span>k), (k, v), |(k, <span class="kw">_</span>)| hasher(<span class="kw-2">&</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">&</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">&mut </span>(<span class="string">"Athenæum"</span>, <span class="number">1807</span>)), <span class="prelude-val">Some</span>(<span class="kw-2">&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">&</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">&mut </span>(<span class="string">"Athenæum"</span>, <span class="number">1807</span>)), <span class="prelude-val">None</span>]);</code></pre></div>
|
||
|
||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code>
|
||
<span class="kw">let </span><span class="kw-2">mut </span>libraries: HashTable<(<span class="kw-2">&</span>str, u32)> = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</span><span class="kw">_</span>| hasher.hash_one(val);
|
||
<span class="kw">for </span>(k, v) <span class="kw">in </span>[
|
||
(<span class="string">"Athenæum"</span>, <span class="number">1807</span>),
|
||
(<span class="string">"Library of Congress"</span>, <span class="number">1800</span>),
|
||
] {
|
||
libraries.insert_unique(hasher(<span class="kw-2">&</span>k), (k, v), |(k, <span class="kw">_</span>)| hasher(<span class="kw-2">&</span>k));
|
||
}
|
||
|
||
<span class="comment">// Duplicate keys result in a panic!
|
||
</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">&</span>k)), |i, val| keys[i] == val.<span class="number">0</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#1105-1111">source</a><h4 class="code-header">pub unsafe fn <a href="#method.get_many_unchecked_mut" class="fn">get_many_unchecked_mut</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>>(
|
||
&mut self,
|
||
hashes: [<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.u64.html">u64</a>; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.array.html">N</a>],
|
||
eq: impl <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a>,
|
||
) -> [<a class="enum" href="https://doc.rust-lang.org/1.83.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&mut T</a>>; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.array.html">N</a>]</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-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>hashbrown::hash_table::Entry;
|
||
<span class="kw">use </span>hashbrown::{HashTable, DefaultHashBuilder};
|
||
<span class="kw">use </span>std::hash::BuildHasher;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>libraries: HashTable<(<span class="kw-2">&</span>str, u32)> = HashTable::new();
|
||
<span class="kw">let </span>hasher = DefaultHashBuilder::default();
|
||
<span class="kw">let </span>hasher = |val: <span class="kw-2">&</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">&</span>k), (k, v), |(k, <span class="kw">_</span>)| hasher(<span class="kw-2">&</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">&</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">&mut </span>(<span class="string">"Athenæum"</span>, <span class="number">1807</span>)), <span class="prelude-val">Some</span>(<span class="kw-2">&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">&</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">&mut </span>(<span class="string">"Athenæum"</span>, <span class="number">1807</span>)), <span class="prelude-val">None</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allocation_size" class="method"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1119-1121">source</a><h4 class="code-header">pub fn <a href="#method.allocation_size" class="fn">allocation_size</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the total amount of memory allocated internally by the hash
|
||
table, in bytes.</p>
|
||
<p>The returned number is informational only. It is intended to be
|
||
primarily used for memory profiling.</p>
|
||
</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#1173-1183">source</a><a href="#impl-Clone-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
|
||
A: Allocator + <a class="trait" href="https://doc.rust-lang.org/1.83.0/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#1178-1182">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> Self</h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.83.0/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.83.0/src/core/clone.rs.html#174">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.83.0/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#1185-1193">source</a><a href="#impl-Debug-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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#1190-1192">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.83.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.83.0/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.83.0/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#1162-1171">source</a><a href="#impl-Default-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
A: Allocator + <a class="trait" href="https://doc.rust-lang.org/1.83.0/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#1166-1170">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.83.0/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#1138-1148">source</a><a href="#impl-IntoIterator-for-%26HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a><T, A><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 class="src rightside" href="../../src/hashbrown/table.rs.html#1142">source</a><a href="#associatedtype.Item-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&'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-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1143">source</a><a href="#associatedtype.IntoIter-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/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><'a, T></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#1145-1147">source</a><a href="#method.into_iter-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> <a class="struct" href="struct.Iter.html" title="struct hashbrown::hash_table::Iter">Iter</a><'a, T> <a href="#" class="tooltip" data-notable-ty="Iter<'a, T>">ⓘ</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.83.0/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#1150-1160">source</a><a href="#impl-IntoIterator-for-%26mut+HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a mut <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a><T, A><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 class="src rightside" href="../../src/hashbrown/table.rs.html#1154">source</a><a href="#associatedtype.Item-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&'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-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1155">source</a><a href="#associatedtype.IntoIter-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/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><'a, T></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#1157-1159">source</a><a href="#method.into_iter-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> <a class="struct" href="struct.IterMut.html" title="struct hashbrown::hash_table::IterMut">IterMut</a><'a, T> <a href="#" class="tooltip" data-notable-ty="IterMut<'a, T>">ⓘ</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.83.0/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#1124-1136">source</a><a href="#impl-IntoIterator-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><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 class="src rightside" href="../../src/hashbrown/table.rs.html#1128">source</a><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/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" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hashbrown/table.rs.html#1129">source</a><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/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><T, A></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#1131-1135">source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> <a class="struct" href="struct.IntoIter.html" title="struct hashbrown::hash_table::IntoIter">IntoIter</a><T, A> <a href="#" class="tooltip" data-notable-ty="IntoIter<T, A>">ⓘ</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.83.0/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-Freeze-for-HashTable%3CT,+A%3E" class="impl"><a href="#impl-Freeze-for-HashTable%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.HashTable.html" title="struct hashbrown::hash_table::HashTable">HashTable</a><T, A><div class="where">where
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a>,</div></h3></section><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<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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.83.0/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<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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<T, A> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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><T, A><div class="where">where
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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.83.0/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.83.0/src/core/any.rs.html#138">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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.83.0/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.83.0/src/core/any.rs.html#139">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.83.0/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.83.0/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.83.0/src/core/borrow.rs.html#209">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/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.83.0/src/core/borrow.rs.html#211">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.83.0/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.83.0/src/core/borrow.rs.html#217">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/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.83.0/src/core/borrow.rs.html#218">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/clone.rs.html#273">source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/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_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/clone.rs.html#275">source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/1.83.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&self, dst: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.pointer.html">*mut T</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dst</code>. <a href="https://doc.rust-lang.org/1.83.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">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.83.0/src/core/convert/mod.rs.html#765">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> 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.83.0/src/core/convert/mod.rs.html#768">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> 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.83.0/src/core/convert/mod.rs.html#748-750">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</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.83.0/src/core/convert/mod.rs.html#758">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> 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.83.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> 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.83.0/src/alloc/borrow.rs.html#82-84">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.83.0/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.83.0/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 class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/alloc/borrow.rs.html#86">source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/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.83.0/src/alloc/borrow.rs.html#87">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.83.0/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.83.0/src/alloc/borrow.rs.html#91">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.reference.html">&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.83.0/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.83.0/src/core/convert/mod.rs.html#805-807">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/convert/mod.rs.html#809">source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.83.0/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.83.0/src/core/convert/mod.rs.html#812">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></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.83.0/src/core/convert/mod.rs.html#790-792">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/convert/mod.rs.html#794">source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/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.83.0/src/core/convert/mod.rs.html#797">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></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><'_, T, A></code></h3><pre><code><div class=\"where\">impl<T, A: Allocator> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/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><'_, T, A></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/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><'_, T, F, A></code></h3><pre><code><div class=\"where\">impl<T, F, A: Allocator> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/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><'_, T, F, A><div class=\"where\">where\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&mut T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/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><T, A></code></h3><pre><code><div class=\"where\">impl<T, A> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IntoIter.html\" title=\"struct hashbrown::hash_table::IntoIter\">IntoIter</a><T, A><div class=\"where\">where\n A: Allocator,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","Iter<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Iter.html\" title=\"struct hashbrown::hash_table::Iter\">Iter</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Iter.html\" title=\"struct hashbrown::hash_table::Iter\">Iter</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&'a T</a>;</div>","Iter<'a, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Iter.html\" title=\"struct hashbrown::hash_table::Iter\">Iter</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Iter.html\" title=\"struct hashbrown::hash_table::Iter\">Iter</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&'a T</a>;</div>","IterHash<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IterHash.html\" title=\"struct hashbrown::hash_table::IterHash\">IterHash</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IterHash.html\" title=\"struct hashbrown::hash_table::IterHash\">IterHash</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&'a T</a>;</div>","IterHashMut<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IterHashMut.html\" title=\"struct hashbrown::hash_table::IterHashMut\">IterHashMut</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IterHashMut.html\" title=\"struct hashbrown::hash_table::IterHashMut\">IterHashMut</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&'a mut T</a>;</div>","IterMut<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IterMut.html\" title=\"struct hashbrown::hash_table::IterMut\">IterMut</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IterMut.html\" title=\"struct hashbrown::hash_table::IterMut\">IterMut</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&'a mut T</a>;</div>","IterMut<'a, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IterMut.html\" title=\"struct hashbrown::hash_table::IterMut\">IterMut</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IterMut.html\" title=\"struct hashbrown::hash_table::IterMut\">IterMut</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.83.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/core/primitive.reference.html\">&'a mut T</a>;</div>"}</script></section></div></main></body></html> |