mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-26 03:49:34 +01:00
570 lines
202 KiB
HTML
570 lines
202 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="A hash set where the iteration order of the values is independent of their hash values."><title>IndexSet in indexmap::set - 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="indexmap" 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="../../indexmap/index.html">indexmap</a><span class="version">2.7.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Index<wbr>Set</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#order" title="Order">Order</a></li><li><a href="#indices" title="Indices">Indices</a></li><li><a href="#complexity" title="Complexity">Complexity</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.append" title="append">append</a></li><li><a href="#method.as_slice" title="as_slice">as_slice</a></li><li><a href="#method.binary_search" title="binary_search">binary_search</a></li><li><a href="#method.binary_search_by" title="binary_search_by">binary_search_by</a></li><li><a href="#method.binary_search_by_key" title="binary_search_by_key">binary_search_by_key</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.contains" title="contains">contains</a></li><li><a href="#method.difference" title="difference">difference</a></li><li><a href="#method.drain" title="drain">drain</a></li><li><a href="#method.first" title="first">first</a></li><li><a href="#method.get" title="get">get</a></li><li><a href="#method.get_full" title="get_full">get_full</a></li><li><a href="#method.get_index" title="get_index">get_index</a></li><li><a href="#method.get_index_of" title="get_index_of">get_index_of</a></li><li><a href="#method.get_range" title="get_range">get_range</a></li><li><a href="#method.hasher" title="hasher">hasher</a></li><li><a href="#method.insert" title="insert">insert</a></li><li><a href="#method.insert_before" title="insert_before">insert_before</a></li><li><a href="#method.insert_full" title="insert_full">insert_full</a></li><li><a href="#method.insert_sorted" title="insert_sorted">insert_sorted</a></li><li>
|
|||
|
hash values.</p>
|
|||
|
<p>The interface is closely compatible with the standard
|
|||
|
<a href="https://doc.rust-lang.org/1.83.0/std/collections/hash/set/struct.HashSet.html" title="struct std::collections::hash::set::HashSet"><code>HashSet</code></a>,
|
|||
|
but also has additional features.</p>
|
|||
|
<h2 id="order"><a class="doc-anchor" href="#order">§</a>Order</h2>
|
|||
|
<p>The values have a consistent order that is determined by the sequence of
|
|||
|
insertion and removal calls on the set. The order does not depend on the
|
|||
|
values or the hash function at all. Note that insertion order and value
|
|||
|
are not affected if a re-insertion is attempted once an element is
|
|||
|
already present.</p>
|
|||
|
<p>All iterators traverse the set <em>in order</em>. Set operation iterators like
|
|||
|
<a href="struct.IndexSet.html#method.union" title="method indexmap::set::IndexSet::union"><code>IndexSet::union</code></a> produce a concatenated order, as do their matching “bitwise”
|
|||
|
operators. See their documentation for specifics.</p>
|
|||
|
<p>The insertion order is preserved, with <strong>notable exceptions</strong> like the
|
|||
|
<a href="struct.IndexSet.html#method.remove" title="method indexmap::set::IndexSet::remove"><code>.remove()</code></a> or <a href="struct.IndexSet.html#method.swap_remove" title="method indexmap::set::IndexSet::swap_remove"><code>.swap_remove()</code></a> methods.
|
|||
|
Methods such as <a href="struct.IndexSet.html#method.sort_by" title="method indexmap::set::IndexSet::sort_by"><code>.sort_by()</code></a> of
|
|||
|
course result in a new order, depending on the sorting order.</p>
|
|||
|
<h2 id="indices"><a class="doc-anchor" href="#indices">§</a>Indices</h2>
|
|||
|
<p>The values are indexed in a compact range without holes in the range
|
|||
|
<code>0..self.len()</code>. For example, the method <code>.get_full</code> looks up the index for
|
|||
|
a value, and the method <code>.get_index</code> looks up the value by index.</p>
|
|||
|
<h2 id="complexity"><a class="doc-anchor" href="#complexity">§</a>Complexity</h2>
|
|||
|
<p>Internally, <code>IndexSet<T, S></code> just holds an <a href="../map/struct.IndexMap.html" title="struct indexmap::map::IndexMap"><code>IndexMap<T, (), S></code></a>. Thus the complexity
|
|||
|
of the two are the same for most methods.</p>
|
|||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>indexmap::IndexSet;
|
|||
|
|
|||
|
<span class="comment">// Collects which letters appear in a sentence.
|
|||
|
</span><span class="kw">let </span>letters: IndexSet<<span class="kw">_</span>> = <span class="string">"a short treatise on fungi"</span>.chars().collect();
|
|||
|
|
|||
|
<span class="macro">assert!</span>(letters.contains(<span class="kw-2">&</span><span class="string">'s'</span>));
|
|||
|
<span class="macro">assert!</span>(letters.contains(<span class="kw-2">&</span><span class="string">'t'</span>));
|
|||
|
<span class="macro">assert!</span>(letters.contains(<span class="kw-2">&</span><span class="string">'u'</span>));
|
|||
|
<span class="macro">assert!</span>(!letters.contains(<span class="kw-2">&</span><span class="string">'y'</span>));</code></pre></div>
|
|||
|
</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-IndexSet%3CT%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#152-169">source</a><a href="#impl-IndexSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T></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/indexmap/set.rs.html#154-158">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section></summary><div class="docblock"><p>Create a new set. (Does not allocate.)</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_capacity" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#164-168">source</a><h4 class="code-header">pub fn <a href="#method.with_capacity" class="fn">with_capacity</a>(n: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Create a new set with capacity for <code>n</code> elements.
|
|||
|
(Does not allocate if <code>n</code> is zero.)</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#171-327">source</a><a href="#impl-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_capacity_and_hasher" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#176-180">source</a><h4 class="code-header">pub fn <a href="#method.with_capacity_and_hasher" class="fn">with_capacity_and_hasher</a>(n: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, hash_builder: S) -> Self</h4></section></summary><div class="docblock"><p>Create a new set with capacity for <code>n</code> elements.
|
|||
|
(Does not allocate if <code>n</code> is zero.)</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_hasher" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#186-190">source</a><h4 class="code-header">pub const fn <a href="#method.with_hasher" class="fn">with_hasher</a>(hash_builder: S) -> Self</h4></section></summary><div class="docblock"><p>Create a new set with <code>hash_builder</code>.</p>
|
|||
|
<p>This function is <code>const</code>, so it
|
|||
|
can be called in <code>static</code> contexts.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.capacity" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#198-200">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/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of elements the set can hold without reallocating.</p>
|
|||
|
<p>This number is a lower bound; the set might be able to hold more,
|
|||
|
but is guaranteed to be able to hold at least this many.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.hasher" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#203-205">source</a><h4 class="code-header">pub fn <a href="#method.hasher" class="fn">hasher</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&S</a></h4></section></summary><div class="docblock"><p>Return a reference to the set’s <code>BuildHasher</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#210-212">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/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of elements in the set.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#217-219">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/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if the set contains no elements.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#222-224">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 indexmap::set::Iter">Iter</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Iter<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Return an iterator over the values of the set, in their order</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#229-231">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>Remove all elements in the set, while preserving its capacity.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.truncate" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#236-238">source</a><h4 class="code-header">pub fn <a href="#method.truncate" class="fn">truncate</a>(&mut self, len: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Shortens the set, keeping the first <code>len</code> elements and dropping the rest.</p>
|
|||
|
<p>If <code>len</code> is greater than the set’s current length, this has no effect.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.drain" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#253-258">source</a><h4 class="code-header">pub fn <a href="#method.drain" class="fn">drain</a><R>(&mut self, range: R) -> <a class="struct" href="struct.Drain.html" title="struct indexmap::set::Drain">Drain</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Drain<'_, T>">ⓘ</a><div class="where">where
|
|||
|
R: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>,</div></h4></section></summary><div class="docblock"><p>Clears the <code>IndexSet</code> in the given index range, returning those values
|
|||
|
as a drain iterator.</p>
|
|||
|
<p>The range may be any type that implements <a href="https://doc.rust-lang.org/1.83.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds"><code>RangeBounds<usize></code></a>,
|
|||
|
including all of the <code>std::ops::Range*</code> types, or even a tuple pair of
|
|||
|
<code>Bound</code> start and end values. To drain the set entirely, use <code>RangeFull</code>
|
|||
|
like <code>set.drain(..)</code>.</p>
|
|||
|
<p>This shifts down all entries following the drained range to fill the
|
|||
|
gap, and keeps the allocated memory for reuse.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if the starting point is greater than the end point or if
|
|||
|
the end point is greater than the length of the set.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_off" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#267-274">source</a><h4 class="code-header">pub fn <a href="#method.split_off" class="fn">split_off</a>(&mut self, at: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>) -> Self<div class="where">where
|
|||
|
S: <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></h4></section></summary><div class="docblock"><p>Splits the collection into two at the given index.</p>
|
|||
|
<p>Returns a newly allocated set containing the elements in the range
|
|||
|
<code>[at, len)</code>. After the call, the original set will be left containing
|
|||
|
the elements <code>[0, at)</code> with its previous capacity unchanged.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if <code>at > len</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#279-281">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/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserve capacity for <code>additional</code> more values.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.reserve_exact" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#291-293">source</a><h4 class="code-header">pub fn <a href="#method.reserve_exact" class="fn">reserve_exact</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserve capacity for <code>additional</code> more values, without over-allocating.</p>
|
|||
|
<p>Unlike <code>reserve</code>, this does not deliberately over-allocate the entry capacity to avoid
|
|||
|
frequent re-allocations. However, the underlying data structures may still have internal
|
|||
|
capacity requirements, and the allocator itself may give more space than requested, so this
|
|||
|
cannot be relied upon to be precisely minimal.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_reserve" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#298-300">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/std/primitive.usize.html">usize</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/std/primitive.unit.html">()</a>, <a class="struct" href="../struct.TryReserveError.html" title="struct indexmap::TryReserveError">TryReserveError</a>></h4></section></summary><div class="docblock"><p>Try to reserve capacity for <code>additional</code> more values.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_reserve_exact" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#310-312">source</a><h4 class="code-header">pub fn <a href="#method.try_reserve_exact" class="fn">try_reserve_exact</a>(
|
|||
|
&mut self,
|
|||
|
additional: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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/std/primitive.unit.html">()</a>, <a class="struct" href="../struct.TryReserveError.html" title="struct indexmap::TryReserveError">TryReserveError</a>></h4></section></summary><div class="docblock"><p>Try to reserve capacity for <code>additional</code> more values, without over-allocating.</p>
|
|||
|
<p>Unlike <code>try_reserve</code>, this does not deliberately over-allocate the entry capacity to avoid
|
|||
|
frequent re-allocations. However, the underlying data structures may still have internal
|
|||
|
capacity requirements, and the allocator itself may give more space than requested, so this
|
|||
|
cannot be relied upon to be precisely minimal.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to_fit" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#317-319">source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit" class="fn">shrink_to_fit</a>(&mut self)</h4></section></summary><div class="docblock"><p>Shrink the capacity of the set as much as possible.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#324-326">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/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Shrink the capacity of the set with a lower limit.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time.</p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexSet%3CT,+S%3E-1" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#329-624">source</a><a href="#impl-IndexSet%3CT,+S%3E-1" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.insert" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#342-344">source</a><h4 class="code-header">pub fn <a href="#method.insert" class="fn">insert</a>(&mut self, value: T) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Insert the value into the set.</p>
|
|||
|
<p>If an equivalent item already exists in the set, it returns
|
|||
|
<code>false</code> leaving the original value in the set and without
|
|||
|
altering its insertion order. Otherwise, it inserts the new
|
|||
|
item and returns <code>true</code>.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (amortized average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_full" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#355-358">source</a><h4 class="code-header">pub fn <a href="#method.insert_full" class="fn">insert_full</a>(&mut self, value: T) -> (<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Insert the value into the set, and get its index.</p>
|
|||
|
<p>If an equivalent item already exists in the set, it returns
|
|||
|
the index of the existing item and <code>false</code>, leaving the
|
|||
|
original value in the set and without altering its insertion
|
|||
|
order. Otherwise, it inserts the new item and returns the index
|
|||
|
of the inserted item and <code>true</code>.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (amortized average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_sorted" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#378-384">source</a><h4 class="code-header">pub fn <a href="#method.insert_sorted" class="fn">insert_sorted</a>(&mut self, value: T) -> (<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a>)<div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Insert the value into the set at its ordered position among sorted values.</p>
|
|||
|
<p>This is equivalent to finding the position with
|
|||
|
<a href="struct.IndexSet.html#method.binary_search" title="method indexmap::set::IndexSet::binary_search"><code>binary_search</code></a>, and if needed calling
|
|||
|
<a href="struct.IndexSet.html#method.insert_before" title="method indexmap::set::IndexSet::insert_before"><code>insert_before</code></a> for a new value.</p>
|
|||
|
<p>If the sorted item is found in the set, it returns the index of that
|
|||
|
existing item and <code>false</code>, without any change. Otherwise, it inserts the
|
|||
|
new item and returns its sorted index and <code>true</code>.</p>
|
|||
|
<p>If the existing items are <strong>not</strong> already sorted, then the insertion
|
|||
|
index is unspecified (like <a href="https://doc.rust-lang.org/1.83.0/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>slice::binary_search</code></a>), but the value
|
|||
|
is moved to or inserted at that position regardless.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average). Instead of repeating calls to
|
|||
|
<code>insert_sorted</code>, it may be faster to call batched <a href="struct.IndexSet.html#method.insert" title="method indexmap::set::IndexSet::insert"><code>insert</code></a>
|
|||
|
or <a href="struct.IndexSet.html#method.extend" title="method indexmap::set::IndexSet::extend"><code>extend</code></a> and only call <a href="struct.IndexSet.html#method.sort" title="method indexmap::set::IndexSet::sort"><code>sort</code></a> or
|
|||
|
<a href="struct.IndexSet.html#method.sort_unstable" title="method indexmap::set::IndexSet::sort_unstable"><code>sort_unstable</code></a> once.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_before" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#429-432">source</a><h4 class="code-header">pub fn <a href="#method.insert_before" class="fn">insert_before</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, value: T) -> (<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Insert the value into the set before the value at the given index, or at the end.</p>
|
|||
|
<p>If an equivalent item already exists in the set, it returns <code>false</code> leaving the
|
|||
|
original value in the set, but moved to the new position. The returned index
|
|||
|
will either be the given index or one less, depending on how the value moved.
|
|||
|
(See <a href="struct.IndexSet.html#method.shift_insert" title="method indexmap::set::IndexSet::shift_insert"><code>shift_insert</code></a> for different behavior here.)</p>
|
|||
|
<p>Otherwise, it inserts the new value exactly at the given index and returns <code>true</code>.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if <code>index</code> is out of bounds.
|
|||
|
Valid indices are <code>0..=set.len()</code> (inclusive).</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</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>indexmap::IndexSet;
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>set: IndexSet<char> = (<span class="string">'a'</span>..=<span class="string">'z'</span>).collect();
|
|||
|
|
|||
|
<span class="comment">// The new value '*' goes exactly at the given index.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">None</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.insert_before(<span class="number">10</span>, <span class="string">'*'</span>), (<span class="number">10</span>, <span class="bool-val">true</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">10</span>));
|
|||
|
|
|||
|
<span class="comment">// Moving the value 'a' up will shift others down, so this moves *before* 10 to index 9.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.insert_before(<span class="number">10</span>, <span class="string">'a'</span>), (<span class="number">9</span>, <span class="bool-val">false</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'a'</span>), <span class="prelude-val">Some</span>(<span class="number">9</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">10</span>));
|
|||
|
|
|||
|
<span class="comment">// Moving the value 'z' down will shift others up, so this moves to exactly 10.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.insert_before(<span class="number">10</span>, <span class="string">'z'</span>), (<span class="number">10</span>, <span class="bool-val">false</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'z'</span>), <span class="prelude-val">Some</span>(<span class="number">10</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">11</span>));
|
|||
|
|
|||
|
<span class="comment">// Moving or inserting before the endpoint is also valid.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.len(), <span class="number">27</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.insert_before(set.len(), <span class="string">'*'</span>), (<span class="number">26</span>, <span class="bool-val">false</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">26</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.insert_before(set.len(), <span class="string">'+'</span>), (<span class="number">27</span>, <span class="bool-val">true</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'+'</span>), <span class="prelude-val">Some</span>(<span class="number">27</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.len(), <span class="number">28</span>);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shift_insert" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#486-488">source</a><h4 class="code-header">pub fn <a href="#method.shift_insert" class="fn">shift_insert</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, value: T) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Insert the value into the set at the given index.</p>
|
|||
|
<p>If an equivalent item already exists in the set, it returns <code>false</code> leaving
|
|||
|
the original value in the set, but moved to the given index.
|
|||
|
Note that existing values <strong>cannot</strong> be moved to <code>index == set.len()</code>!
|
|||
|
(See <a href="struct.IndexSet.html#method.insert_before" title="method indexmap::set::IndexSet::insert_before"><code>insert_before</code></a> for different behavior here.)</p>
|
|||
|
<p>Otherwise, it inserts the new value at the given index and returns <code>true</code>.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if <code>index</code> is out of bounds.
|
|||
|
Valid indices are <code>0..set.len()</code> (exclusive) when moving an existing value, or
|
|||
|
<code>0..=set.len()</code> (inclusive) when inserting a new value.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</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>indexmap::IndexSet;
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>set: IndexSet<char> = (<span class="string">'a'</span>..=<span class="string">'z'</span>).collect();
|
|||
|
|
|||
|
<span class="comment">// The new value '*' goes exactly at the given index.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">None</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.shift_insert(<span class="number">10</span>, <span class="string">'*'</span>), <span class="bool-val">true</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">10</span>));
|
|||
|
|
|||
|
<span class="comment">// Moving the value 'a' up to 10 will shift others down, including the '*' that was at 10.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.shift_insert(<span class="number">10</span>, <span class="string">'a'</span>), <span class="bool-val">false</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'a'</span>), <span class="prelude-val">Some</span>(<span class="number">10</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">9</span>));
|
|||
|
|
|||
|
<span class="comment">// Moving the value 'z' down to 9 will shift others up, including the '*' that was at 9.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.shift_insert(<span class="number">9</span>, <span class="string">'z'</span>), <span class="bool-val">false</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'z'</span>), <span class="prelude-val">Some</span>(<span class="number">9</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">10</span>));
|
|||
|
|
|||
|
<span class="comment">// Existing values can move to len-1 at most, but new values can insert at the endpoint.
|
|||
|
</span><span class="macro">assert_eq!</span>(set.len(), <span class="number">27</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.shift_insert(set.len() - <span class="number">1</span>, <span class="string">'*'</span>), <span class="bool-val">false</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'*'</span>), <span class="prelude-val">Some</span>(<span class="number">26</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.shift_insert(set.len(), <span class="string">'+'</span>), <span class="bool-val">true</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set.get_index_of(<span class="kw-2">&</span><span class="string">'+'</span>), <span class="prelude-val">Some</span>(<span class="number">27</span>));
|
|||
|
<span class="macro">assert_eq!</span>(set.len(), <span class="number">28</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">use </span>indexmap::IndexSet;
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>set: IndexSet<char> = (<span class="string">'a'</span>..=<span class="string">'z'</span>).collect();
|
|||
|
|
|||
|
<span class="comment">// This is an invalid index for moving an existing value!
|
|||
|
</span>set.shift_insert(set.len(), <span class="string">'a'</span>);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.replace" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#495-497">source</a><h4 class="code-header">pub fn <a href="#method.replace" class="fn">replace</a>(&mut self, value: T) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T></h4></section></summary><div class="docblock"><p>Adds a value to the set, replacing the existing value, if any, that is
|
|||
|
equal to the given one, without altering its insertion order. Returns
|
|||
|
the replaced value.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.replace_full" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#504-510">source</a><h4 class="code-header">pub fn <a href="#method.replace_full" class="fn">replace_full</a>(&mut self, value: T) -> (<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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><T>)</h4></section></summary><div class="docblock"><p>Adds a value to the set, replacing the existing value, if any, that is
|
|||
|
equal to the given one, without altering its insertion order. Returns
|
|||
|
the index of the item and its replaced value.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.difference" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#515-520">source</a><h4 class="code-header">pub fn <a href="#method.difference" class="fn">difference</a><'a, S2>(
|
|||
|
&'a self,
|
|||
|
other: &'a <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>,
|
|||
|
) -> <a class="struct" href="struct.Difference.html" title="struct indexmap::set::Difference">Difference</a><'a, T, S2> <a href="#" class="tooltip" data-notable-ty="Difference<'a, T, S2>">ⓘ</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator over the values that are in <code>self</code> but not <code>other</code>.</p>
|
|||
|
<p>Values are produced in the same order that they appear in <code>self</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.symmetric_difference" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#527-535">source</a><h4 class="code-header">pub fn <a href="#method.symmetric_difference" class="fn">symmetric_difference</a><'a, S2>(
|
|||
|
&'a self,
|
|||
|
other: &'a <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>,
|
|||
|
) -> <a class="struct" href="struct.SymmetricDifference.html" title="struct indexmap::set::SymmetricDifference">SymmetricDifference</a><'a, T, S, S2> <a href="#" class="tooltip" data-notable-ty="SymmetricDifference<'a, T, S, S2>">ⓘ</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator over the values that are in <code>self</code> or <code>other</code>,
|
|||
|
but not in both.</p>
|
|||
|
<p>Values from <code>self</code> are produced in their original order, followed by
|
|||
|
values from <code>other</code> in their original order.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.intersection" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#540-545">source</a><h4 class="code-header">pub fn <a href="#method.intersection" class="fn">intersection</a><'a, S2>(
|
|||
|
&'a self,
|
|||
|
other: &'a <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>,
|
|||
|
) -> <a class="struct" href="struct.Intersection.html" title="struct indexmap::set::Intersection">Intersection</a><'a, T, S2> <a href="#" class="tooltip" data-notable-ty="Intersection<'a, T, S2>">ⓘ</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator over the values that are in both <code>self</code> and <code>other</code>.</p>
|
|||
|
<p>Values are produced in the same order that they appear in <code>self</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.union" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#551-556">source</a><h4 class="code-header">pub fn <a href="#method.union" class="fn">union</a><'a, S2>(&'a self, other: &'a <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> <a class="struct" href="struct.Union.html" title="struct indexmap::set::Union">Union</a><'a, T, S> <a href="#" class="tooltip" data-notable-ty="Union<'a, T, S>">ⓘ</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator over all values that are in <code>self</code> or <code>other</code>.</p>
|
|||
|
<p>Values from <code>self</code> are produced in their original order, followed by
|
|||
|
values that are unique to <code>other</code> in their original order.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.splice" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#587-593">source</a><h4 class="code-header">pub fn <a href="#method.splice" class="fn">splice</a><R, I>(
|
|||
|
&mut self,
|
|||
|
range: R,
|
|||
|
replace_with: I,
|
|||
|
) -> <a class="struct" href="struct.Splice.html" title="struct indexmap::set::Splice">Splice</a><'_, I::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, T, S> <a href="#" class="tooltip" data-notable-ty="Splice<'_, I::IntoIter, T, S>">ⓘ</a><div class="where">where
|
|||
|
R: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>,
|
|||
|
I: <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><Item = T>,</div></h4></section></summary><div class="docblock"><p>Creates a splicing iterator that replaces the specified range in the set
|
|||
|
with the given <code>replace_with</code> iterator and yields the removed items.
|
|||
|
<code>replace_with</code> does not need to be the same length as <code>range</code>.</p>
|
|||
|
<p>The <code>range</code> is removed even if the iterator is not consumed until the
|
|||
|
end. It is unspecified how many elements are removed from the set if the
|
|||
|
<code>Splice</code> value is leaked.</p>
|
|||
|
<p>The input iterator <code>replace_with</code> is only consumed when the <code>Splice</code>
|
|||
|
value is dropped. If a value from the iterator matches an existing entry
|
|||
|
in the set (outside of <code>range</code>), then the original will be unchanged.
|
|||
|
Otherwise, the new value will be inserted in the replaced <code>range</code>.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if the starting point is greater than the end point or if
|
|||
|
the end point is greater than the length of the set.</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>indexmap::IndexSet;
|
|||
|
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>set = IndexSet::from([<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
|||
|
<span class="kw">let </span>new = [<span class="number">5</span>, <span class="number">4</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>];
|
|||
|
<span class="kw">let </span>removed: Vec<<span class="kw">_</span>> = set.splice(<span class="number">2</span>..<span class="number">4</span>, new).collect();
|
|||
|
|
|||
|
<span class="comment">// 1 and 4 kept their positions, while 5, 3, and 2 were newly inserted.
|
|||
|
</span><span class="macro">assert!</span>(set.into_iter().eq([<span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>]));
|
|||
|
<span class="macro">assert_eq!</span>(removed, <span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>]);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.append" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#621-623">source</a><h4 class="code-header">pub fn <a href="#method.append" class="fn">append</a><S2>(&mut self, other: &mut <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>)</h4></section></summary><div class="docblock"><p>Moves all values from <code>other</code> into <code>self</code>, leaving <code>other</code> empty.</p>
|
|||
|
<p>This is equivalent to calling <a href="struct.IndexSet.html#method.insert" title="method indexmap::set::IndexSet::insert"><code>insert</code></a> for each value
|
|||
|
from <code>other</code> in order, which means that values that already exist
|
|||
|
in <code>self</code> are unchanged in their current position.</p>
|
|||
|
<p>See also <a href="struct.IndexSet.html#method.union" title="method indexmap::set::IndexSet::union"><code>union</code></a> to iterate the combined values by
|
|||
|
reference, without modifying <code>self</code> or <code>other</code>.</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>indexmap::IndexSet;
|
|||
|
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>a = IndexSet::from([<span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]);
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>b = IndexSet::from([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);
|
|||
|
<span class="kw">let </span>old_capacity = b.capacity();
|
|||
|
|
|||
|
a.append(<span class="kw-2">&mut </span>b);
|
|||
|
|
|||
|
<span class="macro">assert_eq!</span>(a.len(), <span class="number">5</span>);
|
|||
|
<span class="macro">assert_eq!</span>(b.len(), <span class="number">0</span>);
|
|||
|
<span class="macro">assert_eq!</span>(b.capacity(), old_capacity);
|
|||
|
|
|||
|
<span class="macro">assert!</span>(a.iter().eq(<span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">4</span>, <span class="number">5</span>]));</code></pre></div>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexSet%3CT,+S%3E-2" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#626-793">source</a><a href="#impl-IndexSet%3CT,+S%3E-2" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.contains" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#633-638">source</a><h4 class="code-header">pub fn <a href="#method.contains" class="fn">contains</a><Q>(&self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Return <code>true</code> if an equivalent to <code>value</code> exists in the set.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#644-649">source</a><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a><Q>(&self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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/std/primitive.reference.html">&T</a>><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Return a reference to the value stored in the set, if it is present,
|
|||
|
else <code>None</code>.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_full" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#652-657">source</a><h4 class="code-header">pub fn <a href="#method.get_full" class="fn">get_full</a><Q>(&self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</a>)><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Return item index and value</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_index_of" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#662-667">source</a><h4 class="code-header">pub fn <a href="#method.get_index_of" class="fn">get_index_of</a><Q>(&self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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/std/primitive.usize.html">usize</a>><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Return item index, if it exists in the set</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#677-682">source</a><h4 class="code-header">pub fn <a href="#method.remove" class="fn">remove</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: <code>remove</code> disrupts the set order – use <code>swap_remove</code> or <code>shift_remove</code> for explicit behavior.</span></div></span></summary><div class="docblock"><p>Remove the value from the set, and return <code>true</code> if it was present.</p>
|
|||
|
<p><strong>NOTE:</strong> This is equivalent to <a href="struct.IndexSet.html#method.swap_remove" title="method indexmap::set::IndexSet::swap_remove"><code>.swap_remove(value)</code></a>, replacing this
|
|||
|
value’s position with the last element, and it is deprecated in favor of calling that
|
|||
|
explicitly. If you need to preserve the relative order of the values in the set, use
|
|||
|
<a href="struct.IndexSet.html#method.shift_remove" title="method indexmap::set::IndexSet::shift_remove"><code>.shift_remove(value)</code></a> instead.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap_remove" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#693-698">source</a><h4 class="code-header">pub fn <a href="#method.swap_remove" class="fn">swap_remove</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Remove the value from the set, and return <code>true</code> if it was present.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.swap_remove" title="method alloc::vec::Vec::swap_remove"><code>Vec::swap_remove</code></a>, the value is removed by swapping it with the
|
|||
|
last element of the set and popping it off. <strong>This perturbs
|
|||
|
the position of what used to be the last element!</strong></p>
|
|||
|
<p>Return <code>false</code> if <code>value</code> was not in the set.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shift_remove" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#709-714">source</a><h4 class="code-header">pub fn <a href="#method.shift_remove" class="fn">shift_remove</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Remove the value from the set, and return <code>true</code> if it was present.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.remove" title="method alloc::vec::Vec::remove"><code>Vec::remove</code></a>, the value is removed by shifting all of the
|
|||
|
elements that follow it, preserving their relative order.
|
|||
|
<strong>This perturbs the index of all of those elements!</strong></p>
|
|||
|
<p>Return <code>false</code> if <code>value</code> was not in the set.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.take" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#725-730">source</a><h4 class="code-header">pub fn <a href="#method.take" class="fn">take</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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><T><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: <code>take</code> disrupts the set order – use <code>swap_take</code> or <code>shift_take</code> for explicit behavior.</span></div></span></summary><div class="docblock"><p>Removes and returns the value in the set, if any, that is equal to the
|
|||
|
given one.</p>
|
|||
|
<p><strong>NOTE:</strong> This is equivalent to <a href="struct.IndexSet.html#method.swap_take" title="method indexmap::set::IndexSet::swap_take"><code>.swap_take(value)</code></a>, replacing this
|
|||
|
value’s position with the last element, and it is deprecated in favor of calling that
|
|||
|
explicitly. If you need to preserve the relative order of the values in the set, use
|
|||
|
<a href="struct.IndexSet.html#method.shift_take" title="method indexmap::set::IndexSet::shift_take"><code>.shift_take(value)</code></a> instead.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap_take" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#742-747">source</a><h4 class="code-header">pub fn <a href="#method.swap_take" class="fn">swap_take</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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><T><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Removes and returns the value in the set, if any, that is equal to the
|
|||
|
given one.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.swap_remove" title="method alloc::vec::Vec::swap_remove"><code>Vec::swap_remove</code></a>, the value is removed by swapping it with the
|
|||
|
last element of the set and popping it off. <strong>This perturbs
|
|||
|
the position of what used to be the last element!</strong></p>
|
|||
|
<p>Return <code>None</code> if <code>value</code> was not in the set.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shift_take" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#759-764">source</a><h4 class="code-header">pub fn <a href="#method.shift_take" class="fn">shift_take</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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><T><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Removes and returns the value in the set, if any, that is equal to the
|
|||
|
given one.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.remove" title="method alloc::vec::Vec::remove"><code>Vec::remove</code></a>, the value is removed by shifting all of the
|
|||
|
elements that follow it, preserving their relative order.
|
|||
|
<strong>This perturbs the index of all of those elements!</strong></p>
|
|||
|
<p>Return <code>None</code> if <code>value</code> was not in the set.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap_remove_full" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#773-778">source</a><h4 class="code-header">pub fn <a href="#method.swap_remove_full" class="fn">swap_remove_full</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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/std/primitive.usize.html">usize</a>, T)><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Remove the value from the set return it and the index it had.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.swap_remove" title="method alloc::vec::Vec::swap_remove"><code>Vec::swap_remove</code></a>, the value is removed by swapping it with the
|
|||
|
last element of the set and popping it off. <strong>This perturbs
|
|||
|
the position of what used to be the last element!</strong></p>
|
|||
|
<p>Return <code>None</code> if <code>value</code> was not in the set.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shift_remove_full" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#787-792">source</a><h4 class="code-header">pub fn <a href="#method.shift_remove_full" class="fn">shift_remove_full</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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/std/primitive.usize.html">usize</a>, T)><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class="docblock"><p>Remove the value from the set return it and the index it had.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.remove" title="method alloc::vec::Vec::remove"><code>Vec::remove</code></a>, the value is removed by shifting all of the
|
|||
|
elements that follow it, preserving their relative order.
|
|||
|
<strong>This perturbs the index of all of those elements!</strong></p>
|
|||
|
<p>Return <code>None</code> if <code>value</code> was not in the set.</p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexSet%3CT,+S%3E-3" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#795-1065">source</a><a href="#impl-IndexSet%3CT,+S%3E-3" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.pop" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#802-804">source</a><h4 class="code-header">pub fn <a href="#method.pop" class="fn">pop</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T></h4></section></summary><div class="docblock"><p>Remove the last value</p>
|
|||
|
<p>This preserves the order of the remaining elements.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.retain" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#813-818">source</a><h4 class="code-header">pub fn <a href="#method.retain" class="fn">retain</a><F>(&mut self, keep: F)<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/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Scan through each value in the set and keep those where the
|
|||
|
closure <code>keep</code> returns <code>true</code>.</p>
|
|||
|
<p>The elements are visited in order, and remaining elements keep their
|
|||
|
order.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#827-832">source</a><h4 class="code-header">pub fn <a href="#method.sort" class="fn">sort</a>(&mut self)<div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sort the set’s values by their default ordering.</p>
|
|||
|
<p>This is a stable sort – but equivalent values should not normally coexist in
|
|||
|
a set at all, so <a href="struct.IndexSet.html#method.sort_unstable" title="method indexmap::set::IndexSet::sort_unstable"><code>sort_unstable</code></a> is preferred
|
|||
|
because it is generally faster and doesn’t allocate auxiliary memory.</p>
|
|||
|
<p>See <a href="struct.IndexSet.html#method.sort_by" title="method indexmap::set::IndexSet::sort_by"><code>sort_by</code></a> for details.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#837-842">source</a><h4 class="code-header">pub fn <a href="#method.sort_by" class="fn">sort_by</a><F>(&mut self, cmp: F)<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/std/primitive.reference.html">&T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort the set’s values in place using the comparison function <code>cmp</code>.</p>
|
|||
|
<p>Computes in <strong>O(n log n)</strong> time and <strong>O(n)</strong> space. The sort is stable.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_by" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#848-855">source</a><h4 class="code-header">pub fn <a href="#method.sorted_by" class="fn">sorted_by</a><F>(self, cmp: F) -> <a class="struct" href="struct.IntoIter.html" title="struct indexmap::set::IntoIter">IntoIter</a><T> <a href="#" class="tooltip" data-notable-ty="IntoIter<T>">ⓘ</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/std/primitive.reference.html">&T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort the values of the set and return a by-value iterator of
|
|||
|
the values with the result.</p>
|
|||
|
<p>The sort is stable.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_unstable" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#860-865">source</a><h4 class="code-header">pub fn <a href="#method.sort_unstable" class="fn">sort_unstable</a>(&mut self)<div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sort the set’s values by their default ordering.</p>
|
|||
|
<p>See <a href="struct.IndexSet.html#method.sort_unstable_by" title="method indexmap::set::IndexSet::sort_unstable_by"><code>sort_unstable_by</code></a> for details.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_unstable_by" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#870-875">source</a><h4 class="code-header">pub fn <a href="#method.sort_unstable_by" class="fn">sort_unstable_by</a><F>(&mut self, cmp: F)<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/std/primitive.reference.html">&T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort the set’s values in place using the comparison function <code>cmp</code>.</p>
|
|||
|
<p>Computes in <strong>O(n log n)</strong> time. The sort is unstable.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_unstable_by" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#879-886">source</a><h4 class="code-header">pub fn <a href="#method.sorted_unstable_by" class="fn">sorted_unstable_by</a><F>(self, cmp: F) -> <a class="struct" href="struct.IntoIter.html" title="struct indexmap::set::IntoIter">IntoIter</a><T> <a href="#" class="tooltip" data-notable-ty="IntoIter<T>">ⓘ</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/std/primitive.reference.html">&T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort the values of the set and return a by-value iterator of
|
|||
|
the values with the result.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by_cached_key" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#896-904">source</a><h4 class="code-header">pub fn <a href="#method.sort_by_cached_key" class="fn">sort_by_cached_key</a><K, F>(&mut self, sort_key: F)<div class="where">where
|
|||
|
K: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
|
|||
|
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/std/primitive.reference.html">&T</a>) -> K,</div></h4></section></summary><div class="docblock"><p>Sort the set’s values in place using a key extraction function.</p>
|
|||
|
<p>During sorting, the function is called at most once per entry, by using temporary storage
|
|||
|
to remember the results of its evaluation. The order of calls to the function is
|
|||
|
unspecified and may change between versions of <code>indexmap</code> or the standard library.</p>
|
|||
|
<p>Computes in <strong>O(m n + n log n + c)</strong> time () and <strong>O(n)</strong> space, where the function is
|
|||
|
<strong>O(m)</strong>, <em>n</em> is the length of the map, and <em>c</em> the capacity. The sort is stable.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#913-918">source</a><h4 class="code-header">pub fn <a href="#method.binary_search" class="fn">binary_search</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</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/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Search over a sorted set for a value.</p>
|
|||
|
<p>Returns the position where that value is present, or the position where it can be inserted
|
|||
|
to maintain the sort. See <a href="https://doc.rust-lang.org/1.83.0/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>slice::binary_search</code></a> for more details.</p>
|
|||
|
<p>Computes in <strong>O(log(n))</strong> time, which is notably less scalable than looking the value up
|
|||
|
using <a href="struct.IndexSet.html#method.get_index_of" title="method indexmap::set::IndexSet::get_index_of"><code>get_index_of</code></a>, but this can also position missing values.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search_by" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#927-932">source</a><h4 class="code-header">pub fn <a href="#method.binary_search_by" class="fn">binary_search_by</a><'a, F>(&'a self, f: F) -> <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/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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/std/primitive.reference.html">&'a T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Search over a sorted set with a comparator function.</p>
|
|||
|
<p>Returns the position where that value is present, or the position where it can be inserted
|
|||
|
to maintain the sort. See <a href="https://doc.rust-lang.org/1.83.0/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>slice::binary_search_by</code></a> for more details.</p>
|
|||
|
<p>Computes in <strong>O(log(n))</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search_by_key" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#941-947">source</a><h4 class="code-header">pub fn <a href="#method.binary_search_by_key" class="fn">binary_search_by_key</a><'a, B, F>(
|
|||
|
&'a self,
|
|||
|
b: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&B</a>,
|
|||
|
f: F,
|
|||
|
) -> <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/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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/std/primitive.reference.html">&'a T</a>) -> B,
|
|||
|
B: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Search over a sorted set with an extraction function.</p>
|
|||
|
<p>Returns the position where that value is present, or the position where it can be inserted
|
|||
|
to maintain the sort. See <a href="https://doc.rust-lang.org/1.83.0/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>slice::binary_search_by_key</code></a> for more details.</p>
|
|||
|
<p>Computes in <strong>O(log(n))</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.partition_point" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#956-961">source</a><h4 class="code-header">pub fn <a href="#method.partition_point" class="fn">partition_point</a><P>(&self, pred: P) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a><div class="where">where
|
|||
|
P: <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/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns the index of the partition point of a sorted set according to the given predicate
|
|||
|
(the index of the first element of the second partition).</p>
|
|||
|
<p>See <a href="https://doc.rust-lang.org/1.83.0/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>slice::partition_point</code></a> for more details.</p>
|
|||
|
<p>Computes in <strong>O(log(n))</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.reverse" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#966-968">source</a><h4 class="code-header">pub fn <a href="#method.reverse" class="fn">reverse</a>(&mut self)</h4></section></summary><div class="docblock"><p>Reverses the order of the set’s values in place.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time and <strong>O(1)</strong> space.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_slice" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#973-975">source</a><h4 class="code-header">pub fn <a href="#method.as_slice" class="fn">as_slice</a>(&self) -> &<a class="struct" href="struct.Slice.html" title="struct indexmap::set::Slice">Slice</a><T></h4></section></summary><div class="docblock"><p>Returns a slice of all the values in the set.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_boxed_slice" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#980-982">source</a><h4 class="code-header">pub fn <a href="#method.into_boxed_slice" class="fn">into_boxed_slice</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.83.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="struct" href="struct.Slice.html" title="struct indexmap::set::Slice">Slice</a><T>></h4></section></summary><div class="docblock"><p>Converts into a boxed slice of all the values in the set.</p>
|
|||
|
<p>Note that this will drop the inner hash table and any excess capacity.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_index" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#989-991">source</a><h4 class="code-header">pub fn <a href="#method.get_index" class="fn">get_index</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Get a value by index</p>
|
|||
|
<p>Valid indices are <code>0 <= index < self.len()</code>.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_range" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#998-1002">source</a><h4 class="code-header">pub fn <a href="#method.get_range" class="fn">get_range</a><R: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>>(&self, range: R) -> <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="struct" href="struct.Slice.html" title="struct indexmap::set::Slice">Slice</a><T>></h4></section></summary><div class="docblock"><p>Returns a slice of values in the given range of indices.</p>
|
|||
|
<p>Valid indices are <code>0 <= index < self.len()</code>.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.first" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1007-1009">source</a><h4 class="code-header">pub fn <a href="#method.first" class="fn">first</a>(&self) -> <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/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Get the first value</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.last" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1014-1016">source</a><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(&self) -> <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/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Get the last value</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap_remove_index" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1027-1029">source</a><h4 class="code-header">pub fn <a href="#method.swap_remove_index" class="fn">swap_remove_index</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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><T></h4></section></summary><div class="docblock"><p>Remove the value by index</p>
|
|||
|
<p>Valid indices are <code>0 <= index < self.len()</code>.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.swap_remove" title="method alloc::vec::Vec::swap_remove"><code>Vec::swap_remove</code></a>, the value is removed by swapping it with the
|
|||
|
last element of the set and popping it off. <strong>This perturbs
|
|||
|
the position of what used to be the last element!</strong></p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shift_remove_index" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1040-1042">source</a><h4 class="code-header">pub fn <a href="#method.shift_remove_index" class="fn">shift_remove_index</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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><T></h4></section></summary><div class="docblock"><p>Remove the value by index</p>
|
|||
|
<p>Valid indices are <code>0 <= index < self.len()</code>.</p>
|
|||
|
<p>Like <a href="https://doc.rust-lang.org/1.83.0/alloc/vec/struct.Vec.html#method.remove" title="method alloc::vec::Vec::remove"><code>Vec::remove</code></a>, the value is removed by shifting all of the
|
|||
|
elements that follow it, preserving their relative order.
|
|||
|
<strong>This perturbs the index of all of those elements!</strong></p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.move_index" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1053-1055">source</a><h4 class="code-header">pub fn <a href="#method.move_index" class="fn">move_index</a>(&mut self, from: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, to: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Moves the position of a value from one index to another
|
|||
|
by shifting all other values in-between.</p>
|
|||
|
<ul>
|
|||
|
<li>If <code>from < to</code>, the other values will shift down while the targeted value moves up.</li>
|
|||
|
<li>If <code>from > to</code>, the other values will shift up while the targeted value moves down.</li>
|
|||
|
</ul>
|
|||
|
<p><em><strong>Panics</strong></em> if <code>from</code> or <code>to</code> are out of bounds.</p>
|
|||
|
<p>Computes in <strong>O(n)</strong> time (average).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap_indices" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1062-1064">source</a><h4 class="code-header">pub fn <a href="#method.swap_indices" class="fn">swap_indices</a>(&mut self, a: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>, b: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Swaps the position of two values in the set.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if <code>a</code> or <code>b</code> are out of bounds.</p>
|
|||
|
<p>Computes in <strong>O(1)</strong> time (average).</p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexSet%3CT,+S%3E-4" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1192-1224">source</a><a href="#impl-IndexSet%3CT,+S%3E-4" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.is_disjoint" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1198-1207">source</a><h4 class="code-header">pub fn <a href="#method.is_disjoint" class="fn">is_disjoint</a><S2>(&self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if <code>self</code> has no elements in common with <code>other</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_subset" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1210-1215">source</a><h4 class="code-header">pub fn <a href="#method.is_subset" class="fn">is_subset</a><S2>(&self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if all elements of <code>self</code> are contained in <code>other</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_superset" class="method"><a class="src rightside" href="../../src/indexmap/set.rs.html#1218-1223">source</a><h4 class="code-header">pub fn <a href="#method.is_superset" class="fn">is_superset</a><S2>(&self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a><div class="where">where
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if all elements of <code>other</code> are contained in <code>self</code>.</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-BitAnd%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1226-1240">source</a><a href="#impl-BitAnd%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="anchor">§</a><h3 class="code-header">impl<T, S1, S2> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitAnd.html" title="trait core::ops::bit::BitAnd">BitAnd</a><&<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>> for &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</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>,
|
|||
|
S1: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</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>,
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1237-1239">source</a><a href="#method.bitand" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitAnd.html#tymethod.bitand" class="fn">bitand</a>(self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitAnd.html#associatedtype.Output" title="type core::ops::bit::BitAnd::Output">Output</a></h4></section></summary><div class="docblock"><p>Returns the set intersection, cloned into a new set.</p>
|
|||
|
<p>Values are collected in the same order that they appear in <code>self</code>.</p>
|
|||
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Output-8" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1232">source</a><a href="#associatedtype.Output-8" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitAnd.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1></h4></section></summary><div class='docblock'>The resulting type after applying the <code>&</code> operator.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOr%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1242-1257">source</a><a href="#impl-BitOr%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="anchor">§</a><h3 class="code-header">impl<T, S1, S2> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitOr.html" title="trait core::ops::bit::BitOr">BitOr</a><&<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>> for &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</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>,
|
|||
|
S1: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</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>,
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1254-1256">source</a><a href="#method.bitor" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitOr.html#tymethod.bitor" class="fn">bitor</a>(self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitOr.html#associatedtype.Output" title="type core::ops::bit::BitOr::Output">Output</a></h4></section></summary><div class="docblock"><p>Returns the set union, cloned into a new set.</p>
|
|||
|
<p>Values from <code>self</code> are collected in their original order, followed by
|
|||
|
values that are unique to <code>other</code> in their original order.</p>
|
|||
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Output-9" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1248">source</a><a href="#associatedtype.Output-9" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitOr.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1></h4></section></summary><div class='docblock'>The resulting type after applying the <code>|</code> operator.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXor%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1259-1274">source</a><a href="#impl-BitXor%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="anchor">§</a><h3 class="code-header">impl<T, S1, S2> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitXor.html" title="trait core::ops::bit::BitXor">BitXor</a><&<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>> for &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</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>,
|
|||
|
S1: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</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>,
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1271-1273">source</a><a href="#method.bitxor" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitXor.html#tymethod.bitxor" class="fn">bitxor</a>(self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitXor.html#associatedtype.Output" title="type core::ops::bit::BitXor::Output">Output</a></h4></section></summary><div class="docblock"><p>Returns the set symmetric-difference, cloned into a new set.</p>
|
|||
|
<p>Values from <code>self</code> are collected in their original order, followed by
|
|||
|
values from <code>other</code> in their original order.</p>
|
|||
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Output-10" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1265">source</a><a href="#associatedtype.Output-10" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/ops/bit/trait.BitXor.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1></h4></section></summary><div class='docblock'>The resulting type after applying the <code>^</code> operator.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#92-106">source</a><a href="#impl-Clone-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><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>,
|
|||
|
S: <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/indexmap/set.rs.html#97-101">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"><a class="src rightside" href="../../src/indexmap/set.rs.html#103-105">source</a><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, other: &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-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#134-148">source</a><a href="#impl-Debug-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><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>,</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/indexmap/set.rs.html#139-141">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-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1162-1172">source</a><a href="#impl-Default-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <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/indexmap/set.rs.html#1167-1171">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"><p>Return an empty <a href="struct.IndexSet.html" title="struct indexmap::set::IndexSet"><code>IndexSet</code></a></p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Extend%3C%26T%3E-for-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1151-1160">source</a><a href="#impl-Extend%3C%26T%3E-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, S> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&'a T</a>> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + 'a,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extend-1" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1156-1159">source</a><a href="#method.extend-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fn">extend</a><I: <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><Item = <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&'a T</a>>>(&mut self, iterable: I)</h4></section></summary><div class='docblock'>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_one-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/iter/traits/collect.rs.html#454">source</a><a href="#method.extend_one-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fn">extend_one</a>(&mut self, item: 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>extend_one</code>)</span></div></span><div class='docblock'>Extends a collection with exactly one element.</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_reserve-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/iter/traits/collect.rs.html#462">source</a><a href="#method.extend_reserve-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fn">extend_reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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>extend_one</code>)</span></div></span><div class='docblock'>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Extend%3CT%3E-for-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1140-1149">source</a><a href="#impl-Extend%3CT%3E-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a><T> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extend" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1145-1148">source</a><a href="#method.extend" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fn">extend</a><I: <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><Item = T>>(&mut self, iterable: I)</h4></section></summary><div class='docblock'>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_one" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/iter/traits/collect.rs.html#454">source</a><a href="#method.extend_one" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fn">extend_one</a>(&mut self, item: 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>extend_one</code>)</span></div></span><div class='docblock'>Extends a collection with exactly one element.</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_reserve" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.83.0/src/core/iter/traits/collect.rs.html#462">source</a><a href="#method.extend_reserve" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fn">extend_reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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>extend_one</code>)</span></div></span><div class='docblock'>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%5BT;+N%5D%3E-for-IndexSet%3CT%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1122-1138">source</a><a href="#impl-From%3C%5BT;+N%5D%3E-for-IndexSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T, const N: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.array.html">[T; N]</a>> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, <a class="struct" href="https://doc.rust-lang.org/1.83.0/std/hash/random/struct.RandomState.html" title="struct std::hash::random::RandomState">RandomState</a>><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,</div></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="../../src/indexmap/set.rs.html#1135-1137">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>(arr: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.array.html">[T; N]</a>) -> Self</h4></section></summary><div class="docblock"><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>indexmap::IndexSet;
|
|||
|
|
|||
|
<span class="kw">let </span>set1 = IndexSet::from([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
|||
|
<span class="kw">let </span>set2: IndexSet<<span class="kw">_</span>> = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>].into();
|
|||
|
<span class="macro">assert_eq!</span>(set1, set2);</code></pre></div>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromIterator%3CT%3E-for-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1107-1118">source</a><a href="#impl-FromIterator%3CT%3E-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a><T> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</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>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_iter" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1112-1117">source</a><a href="#method.from_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter" class="fn">from_iter</a><I: <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><Item = T>>(iterable: I) -> Self</h4></section></summary><div class='docblock'>Creates a value from an iterator. <a href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3C(Bound%3Cusize%3E,+Bound%3Cusize%3E)%3E-for-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set/slice.rs.html#283-291">source</a><a href="#impl-Index%3C(Bound%3Cusize%3E,+Bound%3Cusize%3E)%3E-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><(<a class="enum" href="https://doc.rust-lang.org/1.83.0/core/ops/range/enum.Bound.html" title="enum core::ops::range::Bound">Bound</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>, <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/ops/range/enum.Bound.html" title="enum core::ops::range::Bound">Bound</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>)> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-6" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set/slice.rs.html#283-291">source</a><a href="#associatedtype.Output-6" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.Slice.html" title="struct indexmap::set::Slice">Slice</a><T></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-6" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set/slice.rs.html#283-291">source</a><a href="#method.index-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, range: (<a class="enum" href="https://doc.rust-lang.org/1.83.0/core/ops/range/enum.Bound.html" title="enum core::ops::range::Bound">Bound</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>, <a class="enum" href="https://doc.rust-lang.org/1.83.0/core/ops/range/enum.Bound.html" title="enum core::ops::range::Bound">Bound</a><<a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>>)) -> &Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a></h4></section></summary>
|
|||
|
<h4 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h4>
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>indexmap::IndexSet;
|
|||
|
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>set = IndexSet::new();
|
|||
|
<span class="kw">for </span>word <span class="kw">in </span><span class="string">"Lorem ipsum dolor sit amet"</span>.split_whitespace() {
|
|||
|
set.insert(word.to_string());
|
|||
|
}
|
|||
|
<span class="macro">assert_eq!</span>(set[<span class="number">0</span>], <span class="string">"Lorem"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set[<span class="number">1</span>], <span class="string">"ipsum"</span>);
|
|||
|
set.reverse();
|
|||
|
<span class="macro">assert_eq!</span>(set[<span class="number">0</span>], <span class="string">"amet"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set[<span class="number">1</span>], <span class="string">"sit"</span>);
|
|||
|
set.sort();
|
|||
|
<span class="macro">assert_eq!</span>(set[<span class="number">0</span>], <span class="string">"Lorem"</span>);
|
|||
|
<span class="macro">assert_eq!</span>(set[<span class="number">1</span>], <span class="string">"amet"</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">use </span>indexmap::IndexSet;
|
|||
|
|
|||
|
<span class="kw">let </span><span class="kw-2">mut </span>set = IndexSet::new();
|
|||
|
set.insert(<span class="string">"foo"</span>);
|
|||
|
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, set[<span class="number">10</span>]); <span class="comment">// panics!</span></code></pre></div>
|
|||
|
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index-7" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1101-1104">source</a><a href="#method.index-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&T</a></h4></section></summary><div class="docblock"><p>Returns a reference to the value at the supplied <code>index</code>.</p>
|
|||
|
<p><em><strong>Panics</strong></em> if <code>index</code> is out of bounds.</p>
|
|||
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Output-7" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1096">source</a><a href="#associatedtype.Output-7" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = T</h4></section></summary><div class='docblock'>The returned type after indexing.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set/iter.rs.html#10-17">source</a><a href="#impl-IntoIterator-for-%26IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S></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/indexmap/set/iter.rs.html#11">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> = <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/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" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set/iter.rs.html#12">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.Iter.html" title="struct indexmap::set::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" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set/iter.rs.html#14-16">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) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</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-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set/iter.rs.html#19-26">source</a><a href="#impl-IntoIterator-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item-1
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="docblock"><p>Opt-in mutable access to <a href="struct.IndexSet.html" title="struct indexmap::set::IndexSet"><code>IndexSet</code></a> values.</p>
|
|||
|
<p>See <a href="trait.MutableValues.html" title="trait indexmap::set::MutableValues"><code>MutableValues</code></a> for more information.</p>
|
|||
|
</div><div class="impl-items"><section id="associatedtype.Value" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set/mutable.rs.html#55">source</a><a href="#associatedtype.Value" class="anchor">§</a><h4 class="code-header">type <a href="trait.MutableValues.html#associatedtype.Value" class="associatedtype">Value</a> = T</h4></section><details class="toggle method-toggle" open><summary><section id="method.get_full_mut2" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set/mutable.rs.html#57-65">source</a><a href="#method.get_full_mut2" class="anchor">§</a><h4 class="code-header">fn <a href="trait.MutableValues.html#tymethod.get_full_mut2" class="fn">get_full_mut2</a><Q>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Q</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/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&mut T</a>)><div class="where">where
|
|||
|
Q: ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><T>,</div></h4></section></summary><div class='docblock'>Return item index and mutable reference to the value <a href="trait.MutableValues.html#tymethod.get_full_mut2">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_index_mut2" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set/mutable.rs.html#67-72">source</a><a href="#method.get_index_mut2" class="anchor">§</a><h4 class="code-header">fn <a href="trait.MutableValues.html#tymethod.get_index_mut2" class="fn">get_index_mut2</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.usize.html">usize</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/std/primitive.reference.html">&mut T</a>></h4></section></summary><div class='docblock'>Return mutable reference to the value at an index. <a href="trait.MutableValues.html#tymethod.get_index_mut2">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.retain2" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set/mutable.rs.html#74-79">source</a><a href="#method.retain2" class="anchor">§</a><h4 class="code-header">fn <a href="trait.MutableValues.html#tymethod.retain2" class="fn">retain2</a><F>(&mut self, keep: F)<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/std/primitive.reference.html">&mut T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class='docblock'>Scan through each value in the set and keep those where the
|
|||
|
closure <code>keep</code> returns <code>true</code>. <a href="trait.MutableValues.html#tymethod.retain2">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CIndexSet%3CT,+S2%3E%3E-for-IndexSet%3CT,+S1%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1174-1183">source</a><a href="#impl-PartialEq%3CIndexSet%3CT,+S2%3E%3E-for-IndexSet%3CT,+S1%3E" class="anchor">§</a><h3 class="code-header">impl<T, S1, S2> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
|
|||
|
S1: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1180-1182">source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" 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/cmp.rs.html#261">source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
|||
|
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1276-1290">source</a><a href="#impl-Sub%3C%26IndexSet%3CT,+S2%3E%3E-for-%26IndexSet%3CT,+S1%3E" class="anchor">§</a><h3 class="code-header">impl<T, S1, S2> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><&<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>> for &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</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>,
|
|||
|
S1: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</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>,
|
|||
|
S2: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sub" class="method trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1287-1289">source</a><a href="#method.sub" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.83.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, other: &<a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S2>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.83.0/core/ops/arith/trait.Sub.html#associatedtype.Output" title="type core::ops::arith::Sub::Output">Output</a></h4></section></summary><div class="docblock"><p>Returns the set difference, cloned into a new set.</p>
|
|||
|
<p>Values are collected in the same order that they appear in <code>self</code>.</p>
|
|||
|
</div></details><details class="toggle" open><summary><section id="associatedtype.Output-11" class="associatedtype trait-impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1282">source</a><a href="#associatedtype.Output-11" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.83.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S1></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details></div></details><section id="impl-Eq-for-IndexSet%3CT,+S%3E" class="impl"><a class="src rightside" href="../../src/indexmap/set.rs.html#1185-1190">source</a><a href="#impl-Eq-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>,</div></h3></section></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-IndexSet%3CT,+S%3E" class="impl"><a href="#impl-Freeze-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <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-IndexSet%3CT,+S%3E" class="impl"><a href="#impl-RefUnwindSafe-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <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-IndexSet%3CT,+S%3E" class="impl"><a href="#impl-Send-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
|
|||
|
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>,</div></h3></section><section id="impl-Sync-for-IndexSet%3CT,+S%3E" class="impl"><a href="#impl-Sync-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
|
|||
|
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>,</div></h3></section><section id="impl-Unpin-for-IndexSet%3CT,+S%3E" class="impl"><a href="#impl-Unpin-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <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-IndexSet%3CT,+S%3E" class="impl"><a href="#impl-UnwindSafe-for-IndexSet%3CT,+S%3E" class="anchor">§</a><h3 class="code-header">impl<T, S> <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.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a><T, S><div class="where">where
|
|||
|
S: <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/std/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/std/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/std/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-Equivalent%3CK%3E-for-Q" class="impl"><a class="src rightside" href="../../src/hashbrown/lib.rs.html#159-162">source</a><a href="#impl-Equivalent%3CK%3E-for-Q" class="anchor">§</a><h3 class="code-header">impl<Q, K> <a class="trait" href="../../hashbrown/trait.Equivalent.html" title="trait hashbrown::Equivalent">Equivalent</a><K> for Q<div class="where">where
|
|||
|
Q: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
K: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<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.equivalent" class="method trait-impl"><a class="src rightside" href="../../src/hashbrown/lib.rs.html#164">source</a><a href="#method.equivalent" class="anchor">§</a><h4 class="code-header">fn <a href="../../hashbrown/trait.Equivalent.html#tymethod.equivalent" class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Checks if this value is equivalent to the given key. <a href="../../hashbrown/trait.Equivalent.html#tymethod.equivalent">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q-1" class="impl"><a class="src rightside" href="../../src/equivalent/lib.rs.html#82-85">source</a><a href="#impl-Equivalent%3CK%3E-for-Q-1" class="anchor">§</a><h3 class="code-header">impl<Q, K> <a class="trait" href="../trait.Equivalent.html" title="trait indexmap::Equivalent">Equivalent</a><K> for Q<div class="where">where
|
|||
|
Q: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.83.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
K: <a class="trait" href="https://doc.rust-lang.org/1.83.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<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.equivalent-1" class="method trait-impl"><a class="src rightside" href="../../src/equivalent/lib.rs.html#88">source</a><a href="#method.equivalent-1" class="anchor">§</a><h4 class="code-header">fn <a href="../trait.Equivalent.html#tymethod.equivalent" class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.83.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Compare self to <code>key</code> and return <code>true</code> if they are equal.</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-1" 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-1" 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/std/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">{"Difference<'a, T, S2>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Difference.html\" title=\"struct indexmap::set::Difference\">Difference</a><'a, T, S></code></h3><pre><code><div class=\"where\">impl<'a, T, S> <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.Difference.html\" title=\"struct indexmap::set::Difference\">Difference</a><'a, T, S><div class=\"where\">where\n T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/hash/trait.Hash.html\" title=\"trait core::hash::Hash\">Hash</a>,\n S: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.83.0/core/hash/trait.BuildHasher.html\" title=\"trait core::hash::BuildHasher\">BuildHasher</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> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.83.0/std/primitive.reference.html\">&'a T</a>;</div>","Drain<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Drain.html\" title=\"struct indexmap::set::Drain\">Drain</a><'_, T></code></h3><pre><code><div class=\"where\">impl<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.Drain.html\" title=\"struct indexmap::set::Drain\">Drain</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=\"associat
|