<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="A hash set implemented as a `HashMap` where the value is `()`."><title>HashSet in hashbrown - 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><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-dd39b87e5fcfba68.css"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="hashbrown"data-themes=""data-resource-suffix=""data-rustdoc-version="1.80.0 (051478957 2024-07-21)"data-channel="1.80.0"data-search-js="search-d52510db62a78183.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-df360f571f6edeae.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../hashbrown/index.html">hashbrown</a><spanclass="version">0.14.5</span></h2></div><h2class="location"><ahref="#">HashSet</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.allocator">allocator</a></li><li><ahref="#method.capacity">capacity</a></li><li><ahref="#method.clear">clear</a></li><li><ahref="#method.contains">contains</a></li><li><ahref="#method.difference">difference</a></li><li><ahref="#method.drain">drain</a></li><li><ahref="#method.entry">entry</a></li><li><ahref="#method.extract_if">extract_if</a></li><li><ahref="#method.get">get</a></li><li><ahref="#method.get_or_insert">get_or_insert</a></li><li><ahref="#method.get_or_insert_owned">get_or_insert_owned</a></li><li><ahref="#method.get_or_insert_with">get_or_insert_with</a></li><li><ahref="#method.hasher">hasher</a></li><li><ahref="#method.insert">insert</a></li><li><ahref="#method.insert_unique_unchecked">insert_unique_unchecked</a></li><li><ahref="#method.intersection">intersection</a></li><li><ahref="#method.is_disjoint">is_disjoint</a></li><li><ahref="#method.is_empty">is_empty</a></li><li><ahref="#method.is_subset">is_subset</a></li><li><ahref="#method.is_superset">is_superset</a></li><li><ahref="#method.iter">iter</a></li><li><ahref="#method.len">len</a></li><li><ahref="#method.raw_table">raw_table</a></li><li><ahref="#method.raw_table_mut">raw_table_mut</a></li><li><ahref="#method.remove">remove</a></li><li><ahref="#method.replace">replace</a></li><li><ahref="#method.reserve">reserve</a></li><li><ahref="#method.retain">retain</a></li><li><ahref="#method.shrink_to">shrink_to</a></li><li><ahref="#method.shrink_to_fit">shrink_to_fit</a></li><li><ahref="#method.symmetric_difference">symmetric_difference</a></li><li><ahref="#method.take">take</a></li><li><ahref="#method.try_reserve">try_reserve</a></li><li><ahref="#method.union">union</a></li><li><ahref="#method.with_capacity_and_hasher">with_capacity_and_hasher</a></li><li><ahref="#metho
<p>As with the <ahref="struct.HashMap.html"><code>HashMap</code></a> type, a <code>HashSet</code> requires that the elements
implement the <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> and <ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> traits. This can frequently be achieved by
using <code>#[derive(PartialEq, Eq, Hash)]</code>. If you implement these yourself,
it is important that the following property holds:</p>
<p>In other words, if two keys are equal, their hashes must be equal.</p>
<p>It is a logic error for an item to be modified in such a way that the
item’s hash, as determined by the <ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> trait, or its equality, as
determined by the <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> trait, changes while it is in the set. This is
normally only possible through <ahref="https://doc.rust-lang.org/std/cell/struct.Cell.html"><code>Cell</code></a>, <ahref="https://doc.rust-lang.org/std/cell/struct.RefCell.html"><code>RefCell</code></a>, global state, I/O, or
unsafe code.</p>
<p>It is also a logic error for the <ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> implementation of a key to panic.
This is generally only possible if the trait is implemented manually. If a
panic does occur then the contents of the <code>HashSet</code> may become corrupted and
<p>The easiest way to use <code>HashSet</code> with a custom type is to derive
<ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> and <ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a>. We must also derive <ahref="https://doc.rust-lang.org/std/cmp/trait.PartialEq.html"><code>PartialEq</code></a>. This will in the
future be implied by <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a>.</p>
</div></details><h2id="implementations"class="section-header">Implementations<ahref="#implementations"class="anchor">§</a></h2><divid="implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#259-434">source</a><ahref="#impl-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A: Allocator><aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.capacity"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#270-272">source</a><h4class="code-header">pub fn <ahref="#method.capacity"class="fn">capacity</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the number of elements the set can hold without reallocating.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.len"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#310-312">source</a><h4class="code-header">pub fn <ahref="#method.len"class="fn">len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the number of elements in the set.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_empty"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#327-329">source</a><h4class="code-header">pub fn <ahref="#method.is_empty"class="fn">is_empty</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the set contains no elements.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.drain"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#349-353">source</a><h4class="code-header">pub fn <ahref="#method.drain"class="fn">drain</a>(&mut self) -><aclass="struct"href="hash_set/struct.Drain.html"title="struct hashbrown::hash_set::Drain">Drain</a><'_, T, A><ahref="#"class="tooltip"data-notable-ty="Drain<'_, T, A>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Clears the set, returning all elements in an iterator.</p>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&T</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass="docblock"><p>Retains only the elements specified by the predicate.</p>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&T</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass="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 <ahref="hash_set/struct.HashSet.html#method.retain"title="method hashbrown::hash_set::HashSet::retain"><code>retain()</code></a> with a negated predicate if you do not need the returned iterator.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-HashSet%3CT,+S%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#436-512">source</a><ahref="#impl-HashSet%3CT,+S%3E"class="anchor">§</a><h3class="code-header">impl<T, S><aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, Global></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_hasher"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#469-473">source</a><h4class="code-header">pub const fn <ahref="#method.with_hasher"class="fn">with_hasher</a>(hasher: S) -> Self</h4></section></summary><divclass="docblock"><p>Creates a new empty hash set which will use the given hasher to hash
keys.</p>
<p>The hash set is initially created with a capacity of 0, so it will not
<p>The <code>hash_builder</code> normally use a fixed key by default and that does
not allow the <code>HashSet</code> to be protected against attacks such as <ahref="https://en.wikipedia.org/wiki/Collision_attack"><code>HashDoS</code></a>.
Users who require HashDoS resistance should explicitly use
[<code>ahash::RandomState</code>] or <ahref="https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html"><code>std::collections::hash_map::RandomState</code></a>
as the hasher when creating a <ahref="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet"><code>HashSet</code></a>.</p>
<p>The <code>hash_builder</code> passed should implement the <ahref="https://doc.rust-lang.org/std/hash/trait.BuildHasher.html"><code>BuildHasher</code></a> trait for
the HashSet to be useful, see its documentation for details.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_capacity_and_hasher"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#507-511">source</a><h4class="code-header">pub fn <ahref="#method.with_capacity_and_hasher"class="fn">with_capacity_and_hasher</a>(capacity: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>, hasher: S) -> Self</h4></section></summary><divclass="docblock"><p>Creates an empty <code>HashSet</code> with the specified capacity, using
<p>The <code>hash_builder</code> normally use a fixed key by default and that does
not allow the <code>HashSet</code> to be protected against attacks such as <ahref="https://en.wikipedia.org/wiki/Collision_attack"><code>HashDoS</code></a>.
Users who require HashDoS resistance should explicitly use
[<code>ahash::RandomState</code>] or <ahref="https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html"><code>std::collections::hash_map::RandomState</code></a>
as the hasher when creating a <ahref="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet"><code>HashSet</code></a>.</p>
<p>The <code>hash_builder</code> passed should implement the <ahref="https://doc.rust-lang.org/std/hash/trait.BuildHasher.html"><code>BuildHasher</code></a> trait for
the HashSet to be useful, see its documentation for details.</p>
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.allocator"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#520-522">source</a><h4class="code-header">pub fn <ahref="#method.allocator"class="fn">allocator</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&A</a></h4></section></summary><divclass="docblock"><p>Returns a reference to the underlying allocator.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_hasher_in"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#556-560">source</a><h4class="code-header">pub const fn <ahref="#method.with_hasher_in"class="fn">with_hasher_in</a>(hasher: S, alloc: A) -> Self</h4></section></summary><divclass="docblock"><p>Creates a new empty hash set which will use the given hasher to hash
keys.</p>
<p>The hash set is initially created with a capacity of 0, so it will not
<p>The <code>hash_builder</code> normally use a fixed key by default and that does
not allow the <code>HashSet</code> to be protected against attacks such as <ahref="https://en.wikipedia.org/wiki/Collision_attack"><code>HashDoS</code></a>.
Users who require HashDoS resistance should explicitly use
[<code>ahash::RandomState</code>] or <ahref="https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html"><code>std::collections::hash_map::RandomState</code></a>
as the hasher when creating a <ahref="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet"><code>HashSet</code></a>.</p>
<p>The <code>hash_builder</code> passed should implement the <ahref="https://doc.rust-lang.org/std/hash/trait.BuildHasher.html"><code>BuildHasher</code></a> trait for
the HashSet to be useful, see its documentation for details.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_capacity_and_hasher_in"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#594-598">source</a><h4class="code-header">pub fn <ahref="#method.with_capacity_and_hasher_in"class="fn">with_capacity_and_hasher_in</a>(capacity: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>, hasher: S, alloc: A) -> Self</h4></section></summary><divclass="docblock"><p>Creates an empty <code>HashSet</code> with the specified capacity, using
<p>The <code>hash_builder</code> normally use a fixed key by default and that does
not allow the <code>HashSet</code> to be protected against attacks such as <ahref="https://en.wikipedia.org/wiki/Collision_attack"><code>HashDoS</code></a>.
Users who require HashDoS resistance should explicitly use
[<code>ahash::RandomState</code>] or <ahref="https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html"><code>std::collections::hash_map::RandomState</code></a>
as the hasher when creating a <ahref="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet"><code>HashSet</code></a>.</p>
<p>The <code>hash_builder</code> passed should implement the <ahref="https://doc.rust-lang.org/std/hash/trait.BuildHasher.html"><code>BuildHasher</code></a> trait for
the HashSet to be useful, see its documentation for details.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.hasher"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#615-617">source</a><h4class="code-header">pub fn <ahref="#method.hasher"class="fn">hasher</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&S</a></h4></section></summary><divclass="docblock"><p>Returns a reference to the set’s <ahref="https://doc.rust-lang.org/std/hash/trait.BuildHasher.html"><code>BuildHasher</code></a>.</p>
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.reserve"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#648-650">source</a><h4class="code-header">pub fn <ahref="#method.reserve"class="fn">reserve</a>(&mut self, additional: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>)</h4></section></summary><divclass="docblock"><p>Reserves capacity for at least <code>additional</code> more elements to be inserted
<p>Panics if the new capacity exceeds <ahref="https://doc.rust-lang.org/std/primitive.isize.html"><code>isize::MAX</code></a> bytes and <ahref="https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html"><code>abort</code></a> the program
in case of allocation error. Use <ahref="hash_set/struct.HashSet.html#method.try_reserve"title="method hashbrown::hash_set::HashSet::try_reserve"><code>try_reserve</code></a> instead
if you want to handle memory allocation failure.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_reserve"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#669-671">source</a><h4class="code-header">pub fn <ahref="#method.try_reserve"class="fn">try_reserve</a>(&mut self, additional: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.unit.html">()</a>, <aclass="enum"href="enum.TryReserveError.html"title="enum hashbrown::TryReserveError">TryReserveError</a>></h4></section></summary><divclass="docblock"><p>Tries to reserve capacity for at least <code>additional</code> more elements to be inserted
set.try_reserve(<spanclass="number">10</span>).expect(<spanclass="string">"why is the test harness OOMing on 10 bytes?"</span>);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.shrink_to_fit"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#690-692">source</a><h4class="code-header">pub fn <ahref="#method.shrink_to_fit"class="fn">shrink_to_fit</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Shrinks the capacity of the set as much as possible. It will drop
down as much as possible while maintaining the internal rules
and possibly leaving some space in accordance with the resize policy.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.shrink_to"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#716-718">source</a><h4class="code-header">pub fn <ahref="#method.shrink_to"class="fn">shrink_to</a>(&mut self, min_capacity: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>)</h4></section></summary><divclass="docblock"><p>Shrinks the capacity of the set with a lower limit. It will drop
Q: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html"title="trait core::hash::Hash">Hash</a> + <aclass="trait"href="trait.Equivalent.html"title="trait hashbrown::Equivalent">Equivalent</a><T> + ?<aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the set contains a value.</p>
<p>The value may be any borrowed form of the set’s value type, but
<ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> and <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
Q: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html"title="trait core::hash::Hash">Hash</a> + <aclass="trait"href="trait.Equivalent.html"title="trait hashbrown::Equivalent">Equivalent</a><T> + ?<aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><divclass="docblock"><p>Returns a reference to the value in the set, if any, that is equal to the given value.</p>
<p>The value may be any borrowed form of the set’s value type, but
<ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> and <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_or_insert"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#913-921">source</a><h4class="code-header">pub fn <ahref="#method.get_or_insert"class="fn">get_or_insert</a>(&mut self, value: T) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&T</a></h4></section></summary><divclass="docblock"><p>Inserts the given <code>value</code> into the set if it is not present, then
Q: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html"title="trait core::hash::Hash">Hash</a> + <aclass="trait"href="trait.Equivalent.html"title="trait hashbrown::Equivalent">Equivalent</a><T> + <aclass="trait"href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a><Owned = T> + ?<aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><divclass="docblock"><p>Inserts an owned copy of the given <code>value</code> into the set if it is not
<spanclass="macro">assert_eq!</span>(set.len(), <spanclass="number">4</span>); <spanclass="comment">// a new "fish" was inserted</span></code></pre></div>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&Q</a>) -> T,</div></h4></section></summary><divclass="docblock"><p>Inserts a value computed from <code>f</code> into the set if the given <code>value</code> is
<spanclass="macro">assert_eq!</span>(set.len(), <spanclass="number">4</span>); <spanclass="comment">// a new "fish" was inserted</span></code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.entry"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1022-1027">source</a><h4class="code-header">pub fn <ahref="#method.entry"class="fn">entry</a>(&mut self, value: T) -><aclass="enum"href="hash_set/enum.Entry.html"title="enum hashbrown::hash_set::Entry">Entry</a><'_, T, S, A></h4></section></summary><divclass="docblock"><p>Gets the given value’s corresponding entry in the set for in-place manipulation.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_disjoint"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1046-1048">source</a><h4class="code-header">pub fn <ahref="#method.is_disjoint"class="fn">is_disjoint</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&Self</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if <code>self</code> has no elements in common with <code>other</code>.
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_subset"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1067-1069">source</a><h4class="code-header">pub fn <ahref="#method.is_subset"class="fn">is_subset</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&Self</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the set is a subset of another,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_superset"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1092-1094">source</a><h4class="code-header">pub fn <ahref="#method.is_superset"class="fn">is_superset</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&Self</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the set is a superset of another,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.insert"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1114-1116">source</a><h4class="code-header">pub fn <ahref="#method.insert"class="fn">insert</a>(&mut self, value: T) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Adds a value to the set.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.insert_unique_unchecked"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1138-1140">source</a><h4class="code-header">pub fn <ahref="#method.insert_unique_unchecked"class="fn">insert_unique_unchecked</a>(&mut self, value: T) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&T</a></h4></section></summary><divclass="docblock"><p>Insert a value the set without checking if the value already exists in the set.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.replace"class="method"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1158-1166">source</a><h4class="code-header">pub fn <ahref="#method.replace"class="fn">replace</a>(&mut self, value: T) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><T></h4></section></summary><divclass="docblock"><p>Adds a value to the set, replacing the existing value, if any, that is equal to the given
Q: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html"title="trait core::hash::Hash">Hash</a> + <aclass="trait"href="trait.Equivalent.html"title="trait hashbrown::Equivalent">Equivalent</a><T> + ?<aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><divclass="docblock"><p>Removes a value from the set. Returns whether the value was
<p>The value may be any borrowed form of the set’s value type, but
<ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> and <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
Q: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html"title="trait core::hash::Hash">Hash</a> + <aclass="trait"href="trait.Equivalent.html"title="trait hashbrown::Equivalent">Equivalent</a><T> + ?<aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><divclass="docblock"><p>Removes and returns the value in the set, if any, that is equal to the given one.</p>
<p>The value may be any borrowed form of the set’s value type, but
<ahref="https://doc.rust-lang.org/std/hash/trait.Hash.html"><code>Hash</code></a> and <ahref="https://doc.rust-lang.org/std/cmp/trait.Eq.html"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
<p>Calling this function is safe, but using the raw hash table API may require
unsafe functions or blocks.</p>
<p><code>RawTable</code> API gives the lowest level of control under the set that can be useful
for extending the HashSet’s API, but may lead to <em><ahref="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>.</p>
<p>Calling this function is safe, but using the raw hash table API may require
unsafe functions or blocks.</p>
<p><code>RawTable</code> API gives the lowest level of control under the set that can be useful
for extending the HashSet’s API, but may lead to <em><ahref="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>.</p>
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.bitand"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1470-1472">source</a><ahref="#method.bitand"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/ops/bit/trait.BitAnd.html#tymethod.bitand"class="fn">bitand</a>(self, rhs: &<aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A>) -><aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S></h4></section></summary><divclass="docblock"><p>Returns the intersection of <code>self</code> and <code>rhs</code> as a new <code>HashSet<T, S></code>.</p>
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.bitor"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1437-1439">source</a><ahref="#method.bitor"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/ops/bit/trait.BitOr.html#tymethod.bitor"class="fn">bitor</a>(self, rhs: &<aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A>) -><aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S></h4></section></summary><divclass="docblock"><p>Returns the union of <code>self</code> and <code>rhs</code> as a new <code>HashSet<T, S></code>.</p>
S: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.BuildHasher.html"title="trait core::hash::BuildHasher">BuildHasher</a> + <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html"title="trait core::default::Default">Default</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.bitxor"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1502-1504">source</a><ahref="#method.bitxor"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/ops/bit/trait.BitXor.html#tymethod.bitxor"class="fn">bitxor</a>(self, rhs: &<aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S>) -><aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S></h4></section></summary><divclass="docblock"><p>Returns the symmetric difference of <code>self</code> and <code>rhs</code> as a new <code>HashSet<T, S></code>.</p>
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.fmt"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1298-1300">source</a><ahref="#method.fmt"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html#tymethod.fmt"class="fn">fmt</a>(&self, f: &mut <aclass="struct"href="https://doc.rust-lang.org/1.80.0/core/fmt/struct.Formatter.html"title="struct core::fmt::Formatter">Formatter</a><'_>) -><aclass="type"href="https://doc.rust-lang.org/1.80.0/core/fmt/type.Result.html"title="type core::fmt::Result">Result</a></h4></section></summary><divclass='docblock'>Formats the value using the given formatter. <ahref="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Default-for-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1395-1407">source</a><ahref="#impl-Default-for-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html"title="trait core::default::Default">Default</a> for <aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A><divclass="where">where
A: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html"title="trait core::default::Default">Default</a> + Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.default"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1402-1406">source</a><ahref="#method.default"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html#tymethod.default"class="fn">default</a>() -> Self</h4></section></summary><divclass="docblock"><p>Creates an empty <code>HashSet<T, S></code> with the <code>Default</code> value for the hasher.</p>
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1378-1380">source</a><ahref="#method.extend"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend"class="fn">extend</a><I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html"title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&'a T</a>>>(&mut self, iter: I)</h4></section></summary><divclass='docblock'>Extends a collection with the contents of an iterator. <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_one"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/iter/traits/collect.rs.html#453">source</a><ahref="#method.extend_one"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#method.extend_one"class="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Extends a collection with exactly one element.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_reserve"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/iter/traits/collect.rs.html#461">source</a><ahref="#method.extend_reserve"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve"class="fn">extend_reserve</a>(&mut self, additional: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Reserves capacity in a collection for the given number of additional elements. <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Extend%3CT%3E-for-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1347-1369">source</a><ahref="#impl-Extend%3CT%3E-for-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html"title="trait core::iter::traits::collect::Extend">Extend</a><T> for <aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A><divclass="where">where
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend-1"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1354-1356">source</a><ahref="#method.extend-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend"class="fn">extend</a><I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html"title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = T>>(&mut self, iter: I)</h4></section></summary><divclass='docblock'>Extends a collection with the contents of an iterator. <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_one-1"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/iter/traits/collect.rs.html#453">source</a><ahref="#method.extend_one-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#method.extend_one"class="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Extends a collection with exactly one element.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_reserve-1"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/iter/traits/collect.rs.html#461">source</a><ahref="#method.extend_reserve-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve"class="fn">extend_reserve</a>(&mut self, additional: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.usize.html">usize</a>)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Reserves capacity in a collection for the given number of additional elements. <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-From%3CHashMap%3CT,+(),+S,+A%3E%3E-for-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1303-1310">source</a><ahref="#impl-From%3CHashMap%3CT,+(),+S,+A%3E%3E-for-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><<aclass="struct"href="hash_map/struct.HashMap.html"title="struct hashbrown::hash_map::HashMap">HashMap</a><T, <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.unit.html">()</a>, S, A>> for <aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A><divclass="where">where
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1307-1309">source</a><ahref="#method.from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html#tymethod.from"class="fn">from</a>(map: <aclass="struct"href="hash_map/struct.HashMap.html"title="struct hashbrown::hash_map::HashMap">HashMap</a><T, <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.unit.html">()</a>, S, A>) -> Self</h4></section></summary><divclass='docblock'>Converts to this type from the input type.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-FromIterator%3CT%3E-for-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1312-1324">source</a><ahref="#impl-FromIterator%3CT%3E-for-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.FromIterator.html"title="trait core::iter::traits::collect::FromIterator">FromIterator</a><T> for <aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A><divclass="where">where
A: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html"title="trait core::default::Default">Default</a> + Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from_iter"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1319-1323">source</a><ahref="#method.from_iter"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter"class="fn">from_iter</a><I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html"title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = T>>(iter: I) -> Self</h4></section></summary><divclass='docblock'>Creates a value from an iterator. <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-IntoIterator-for-%26HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1638-1646">source</a><ahref="#impl-IntoIterator-for-%26HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<'a, T, S, A: Allocator><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html"title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a <aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Item-1"class="associatedtype trait-impl"><ahref="#associatedtype.Item-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item"class="associatedtype">Item</a> = <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&'a T</a></h4></section></summary><divclass='docblock'>The type of the elements being iterated over.</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.IntoIter-1"class="associatedtype trait-impl"><ahref="#associatedtype.IntoIter-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter"class="associatedtype">IntoIter</a> = <aclass="struct"href="hash_set/struct.Iter.html"title="struct hashbrown::hash_set::Iter">Iter</a><'a, T></h4></section></summary><divclass='docblock'>Which kind of iterator are we turning this into?</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.into_iter-1"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1643-1645">source</a><ahref="#method.into_iter-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter"class="fn">into_iter</a>(self) -><aclass="struct"href="hash_set/struct.Iter.html"title="struct hashbrown::hash_set::Iter">Iter</a><'a, T><ahref="#"class="tooltip"data-notable-ty="Iter<'a, T>">ⓘ</a></h4></section></summary><divclass='docblock'>Creates an iterator from a value. <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-IntoIterator-for-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1648-1678">source</a><ahref="#impl-IntoIterator-for-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A: Allocator>
</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.Item"class="associatedtype trait-impl"><ahref="#associatedtype.Item"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item"class="associatedtype">Item</a> = T</h4></section></summary><divclass='docblock'>The type of the elements being iterated over.</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.IntoIter"class="associatedtype trait-impl"><ahref="#associatedtype.IntoIter"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter"class="associatedtype">IntoIter</a> = <aclass="struct"href="hash_set/struct.IntoIter.html"title="struct hashbrown::hash_set::IntoIter">IntoIter</a><T, A></h4></section></summary><divclass='docblock'>Which kind of iterator are we turning this into?</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq-for-HashSet%3CT,+S,+A%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1270-1283">source</a><ahref="#impl-PartialEq-for-HashSet%3CT,+S,+A%3E"class="anchor">§</a><h3class="code-header">impl<T, S, A><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a> for <aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S, A><divclass="where">where
A: Allocator,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1276-1282">source</a><ahref="#method.eq"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html#tymethod.eq"class="fn">eq</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&Self</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne"class="method trait-impl"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="src"href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#263">source</a></span><ahref="#method.ne"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html#method.ne"class="fn">ne</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&Rhs</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Sub%3C%26HashSet%3CT,+S%3E%3E-for-%26HashSet%3CT,+S%3E"class="impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1507-1537">source</a><ahref="#impl-Sub%3C%26HashSet%3CT,+S%3E%3E-for-%26HashSet%3CT,+S%3E"class="anchor">§</a><h3class="code-header">impl<T, S><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/arith/trait.Sub.html"title="trait core::ops::arith::Sub">Sub</a><&<aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S>> for &<aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S><divclass="where">where
S: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/hash/trait.BuildHasher.html"title="trait core::hash::BuildHasher">BuildHasher</a> + <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html"title="trait core::default::Default">Default</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.sub"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/set.rs.html#1534-1536">source</a><ahref="#method.sub"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/ops/arith/trait.Sub.html#tymethod.sub"class="fn">sub</a>(self, rhs: &<aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S>) -><aclass="struct"href="hash_set/struct.HashSet.html"title="struct hashbrown::hash_set::HashSet">HashSet</a><T, S></h4></section></summary><divclass="docblock"><p>Returns the difference of <code>self</code> and <code>rhs</code> as a new <code>HashSet<T, S></code>.</p>
K: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html"title="trait core::borrow::Borrow">Borrow</a><Q> + ?<aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.equivalent"class="method trait-impl"><aclass="src rightside"href="../src/hashbrown/lib.rs.html#171-173">source</a><ahref="#method.equivalent"class="anchor">§</a><h4class="code-header">fn <ahref="trait.Equivalent.html#tymethod.equivalent"class="fn">equivalent</a>(&self, key: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&K</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>Checks if this value is equivalent to the given key. <ahref="trait.Equivalent.html#tymethod.equivalent">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-From%3CT%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#765">source</a><ahref="#impl-From%3CT%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from-1"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#768">source</a><ahref="#method.from-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html#tymethod.from"class="fn">from</a>(t: T) -> T</h4></section></summary><divclass="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Into%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#748-750">source</a><ahref="#impl-Into%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><U> for T<divclass="where">where
<code><ahref="https://doc.rust-lang.org/1.80.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><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/core/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#805-807">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#812">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#790-792">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#797">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div><scripttype="text/json"id="notable-traits-data">{"Difference<'a,T,S,A>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"hash_set/struct.Difference.html\"title=\"structhashbrown::hash_set::Difference\">Difference</a><'a,T,S,A></code></h3><pre><code><divclass=\"where\">impl<'a,T,S,A><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"hash_set/struct.Difference.html\"title=\"structhashbrown::hash_set::Difference\">Difference</a><'a,T,S,A><divclass=\"where\">where\nT:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html\"title=\"traitcore::cmp::Eq\">Eq</a>+<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html\"title=\"traitcore::hash::Hash\">Hash</a>,\nS:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/hash/trait.BuildHasher.html\"title=\"traitcore::hash::BuildHasher\">BuildHasher</a>,\nA:Allocator,</div></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"primitive\"href=\"https://doc.rust-lang.org/1.80.0/core/primitive.reference.html\">&'aT</a>;</div>","Drain<'_,T,A>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"hash_set/struct.Drain.html\"title=\"structhashbrown::hash_set::Drain\">Drain</a><'_,K,A></code></h3><pre><code><divclass=\"where\">impl<K,A:Allocator><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"hash_set/struct.Drain.html\"title=\"structhashbrown::hash_set::Drain\">Drain</a><'_,K,A></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=