422 lines
90 KiB
HTML
422 lines
90 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="API documentation for the Rust `BinaryHeap` struct in crate `nom`."><meta name="keywords" content="rust, rustlang, rust-lang, BinaryHeap"><title>nom::lib::std::collections::BinaryHeap - Rust</title><link rel="stylesheet" type="text/css" href="../../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../../light.css" id="themeStyle"><script src="../../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../../../nom/index.html'><div class='logo-container'><img src='../../../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct BinaryHeap</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.append">append</a><a href="#method.capacity">capacity</a><a href="#method.clear">clear</a><a href="#method.drain">drain</a><a href="#method.drain_sorted">drain_sorted</a><a href="#method.into_iter_sorted">into_iter_sorted</a><a href="#method.into_sorted_vec">into_sorted_vec</a><a href="#method.into_vec">into_vec</a><a href="#method.is_empty">is_empty</a><a href="#method.iter">iter</a><a href="#method.len">len</a><a href="#method.new">new</a><a href="#method.peek">peek</a><a href="#method.peek_mut">peek_mut</a><a href="#method.pop">pop</a><a href="#method.push">push</a><a href="#method.reserve">reserve</a><a href="#method.reserve_exact">reserve_exact</a><a href="#method.shrink_to">shrink_to</a><a href="#method.shrink_to_fit">shrink_to_fit</a><a href="#method.with_capacity">with_capacity</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-Extend%3C%26%27a%20T%3E">Extend<&'a T></a><a href="#impl-Extend%3CT%3E">Extend<T></a><a href="#impl-From%3CBinaryHeap%3CT%3E%3E">From<BinaryHeap<T>></a><a href="#impl-From%3CVec%3CT%3E%3E">From<Vec<T>></a><a href="#impl-FromIterator%3CT%3E">FromIterator<T></a><a href="#impl-IntoIterator">IntoIterator</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-IntoIterator">IntoIterator</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class='location'><a href='../../../index.html'>nom</a>::<wbr><a href='../../index.html'>lib</a>::<wbr><a href='../index.html'>std</a>::<wbr><a href='index.html'>collections</a></p><script>window.sidebarCurrent = {name: 'BinaryHeap', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../../../../settings.html"><img src="../../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#249-251' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../../../index.html'>nom</a>::<wbr><a href='../../index.html'>lib</a>::<wbr><a href='../index.html'>std</a>::<wbr><a href='index.html'>collections</a>::<wbr><a class="struct" href=''>BinaryHeap</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct BinaryHeap<T> { /* fields omitted */ }</pre></div><div class='docblock'><p>A priority queue implemented with a binary heap.</p>
|
||
<p>This will be a max-heap.</p>
|
||
<p>It is a logic error for an item to be modified in such a way that the
|
||
item's ordering relative to any other item, as determined by the <code>Ord</code>
|
||
trait, changes while it is in the heap. This is normally only possible
|
||
through <code>Cell</code>, <code>RefCell</code>, global state, I/O, or unsafe code.</p>
|
||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
|
||
<span class="comment">// Type inference lets us omit an explicit type signature (which</span>
|
||
<span class="comment">// would be `BinaryHeap<i32>` in this example).</span>
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
|
||
<span class="comment">// We can use peek to look at the next item in the heap. In this case,</span>
|
||
<span class="comment">// there's no items in there yet so we get None.</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek</span>(), <span class="prelude-val">None</span>);
|
||
|
||
<span class="comment">// Let's add some scores...</span>
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">1</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">5</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">2</span>);
|
||
|
||
<span class="comment">// Now peek shows the most important item in the heap.</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">5</span>));
|
||
|
||
<span class="comment">// We can check the length of a heap.</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">len</span>(), <span class="number">3</span>);
|
||
|
||
<span class="comment">// We can iterate over the items in the heap, although they are returned in</span>
|
||
<span class="comment">// a random order.</span>
|
||
<span class="kw">for</span> <span class="ident">x</span> <span class="kw">in</span> <span class="kw-2">&</span><span class="ident">heap</span> {
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{}"</span>, <span class="ident">x</span>);
|
||
}
|
||
|
||
<span class="comment">// If we instead pop these scores, they should come back in order.</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="number">5</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="number">2</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">None</span>);
|
||
|
||
<span class="comment">// We can clear the heap of any remaining items.</span>
|
||
<span class="ident">heap</span>.<span class="ident">clear</span>();
|
||
|
||
<span class="comment">// The heap should now be empty.</span>
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">is_empty</span>())</pre></div>
|
||
<h2 id="min-heap" class="section-header"><a href="#min-heap">Min-heap</a></h2>
|
||
<p>Either <code>std::cmp::Reverse</code> or a custom <code>Ord</code> implementation can be used to
|
||
make <code>BinaryHeap</code> a min-heap. This makes <code>heap.pop()</code> return the smallest
|
||
value instead of the greatest one.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cmp</span>::<span class="ident">Reverse</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
|
||
<span class="comment">// Wrap values in `Reverse`</span>
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="ident">Reverse</span>(<span class="number">1</span>));
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="ident">Reverse</span>(<span class="number">5</span>));
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="ident">Reverse</span>(<span class="number">2</span>));
|
||
|
||
<span class="comment">// If we pop these scores now, they should come back in the reverse order.</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="ident">Reverse</span>(<span class="number">1</span>)));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="ident">Reverse</span>(<span class="number">2</span>)));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="ident">Reverse</span>(<span class="number">5</span>)));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">None</span>);</pre></div>
|
||
<h1 id="time-complexity" class="section-header"><a href="#time-complexity">Time complexity</a></h1><table><thead><tr><th><a href="#method.push">push</a></th><th><a href="#method.pop">pop</a></th><th><a href="#method.peek">peek</a>/<a href="#method.peek_mut">peek_mut</a></th></tr></thead><tbody>
|
||
<tr><td>O(1)~</td><td>O(log n)</td><td>O(1)</td></tr>
|
||
</tbody></table>
|
||
<p>The value for <code>push</code> is an expected cost; the method documentation gives a
|
||
more detailed analysis.</p>
|
||
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl<T> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Ord.html" title="trait nom::lib::std::prelude::v1::v1::Ord">Ord</a>, </span></code><a href='#impl' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#339-670' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>() -> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#352-354' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an empty <code>BinaryHeap</code> as a max-heap.</p>
|
||
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">4</span>);</pre></div>
|
||
</div><h4 id='method.with_capacity' class="method"><code id='with_capacity.v'>pub fn <a href='#method.with_capacity' class='fnname'>with_capacity</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#371-373' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an empty <code>BinaryHeap</code> with a specific capacity.
|
||
This preallocates enough memory for <code>capacity</code> elements,
|
||
so that the <code>BinaryHeap</code> does not have to be reallocated
|
||
until it contains at least that many values.</p>
|
||
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">with_capacity</span>(<span class="number">10</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">4</span>);</pre></div>
|
||
</div><h4 id='method.peek_mut' class="method"><code id='peek_mut.v'>pub fn <a href='#method.peek_mut' class='fnname'>peek_mut</a>(&mut self) -> <a class="enum" href="../../../../nom/lib/std/prelude/v1/v1/enum.Option.html" title="enum nom::lib::std::prelude::v1::v1::Option">Option</a><<a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.PeekMut.html" title="struct nom::lib::std::collections::binary_heap::PeekMut">PeekMut</a><T>></code><span class='since' title='Stable since Rust version 1.12.0'>1.12.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#404-406' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns a mutable reference to the greatest item in the binary heap, or
|
||
<code>None</code> if it is empty.</p>
|
||
<p>Note: If the <code>PeekMut</code> value is leaked, the heap may be in an
|
||
inconsistent state.</p>
|
||
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek_mut</span>().<span class="ident">is_none</span>());
|
||
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">1</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">5</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">2</span>);
|
||
{
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">val</span> <span class="op">=</span> <span class="ident">heap</span>.<span class="ident">peek_mut</span>().<span class="ident">unwrap</span>();
|
||
<span class="kw-2">*</span><span class="ident">val</span> <span class="op">=</span> <span class="number">0</span>;
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">2</span>));</pre></div>
|
||
<h1 id="time-complexity-1" class="section-header"><a href="#time-complexity-1">Time complexity</a></h1>
|
||
<p>Cost is O(1) in the worst case.</p>
|
||
</div><h4 id='method.pop' class="method"><code id='pop.v'>pub fn <a href='#method.pop' class='fnname'>pop</a>(&mut self) -> <a class="enum" href="../../../../nom/lib/std/prelude/v1/v1/enum.Option.html" title="enum nom::lib::std::prelude::v1::v1::Option">Option</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#429-437' title='goto source code'>[src]</a></h4><div class='docblock'><p>Removes the greatest item from the binary heap and returns it, or <code>None</code> if it
|
||
is empty.</p>
|
||
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">3</span>]);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="number">3</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">pop</span>(), <span class="prelude-val">None</span>);</pre></div>
|
||
<h1 id="time-complexity-2" class="section-header"><a href="#time-complexity-2">Time complexity</a></h1>
|
||
<p>The worst case cost of <code>pop</code> on a heap containing <em>n</em> elements is O(log
|
||
n).</p>
|
||
</div><h4 id='method.push' class="method"><code id='push.v'>pub fn <a href='#method.push' class='fnname'>push</a>(&mut self, item: T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#472-476' title='goto source code'>[src]</a></h4><div class='docblock'><p>Pushes an item onto the binary heap.</p>
|
||
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">3</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">5</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">1</span>);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">len</span>(), <span class="number">3</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">5</span>));</pre></div>
|
||
<h1 id="time-complexity-3" class="section-header"><a href="#time-complexity-3">Time complexity</a></h1>
|
||
<p>The expected cost of <code>push</code>, averaged over every possible ordering of
|
||
the elements being pushed, and over a sufficiently large number of
|
||
pushes, is O(1). This is the most meaningful cost metric when pushing
|
||
elements that are <em>not</em> already in any sorted pattern.</p>
|
||
<p>The time complexity degrades if elements are pushed in predominantly
|
||
ascending order. In the worst case, elements are pushed in ascending
|
||
sorted order and the amortized cost per push is O(log n) against a heap
|
||
containing <em>n</em> elements.</p>
|
||
<p>The worst case cost of a <em>single</em> call to <code>push</code> is O(n). The worst case
|
||
occurs when capacity is exhausted and needs a resize. The resize cost
|
||
has been amortized in the previous figures.</p>
|
||
</div><h4 id='method.into_sorted_vec' class="method"><code id='into_sorted_vec.v'>pub fn <a href='#method.into_sorted_vec' class='fnname'>into_sorted_vec</a>(self) -> <a class="struct" href="../../../../nom/lib/std/prelude/v1/v1/struct.Vec.html" title="struct nom::lib::std::prelude::v1::v1::Vec">Vec</a><T></code><span class='since' title='Stable since Rust version 1.5.0'>1.5.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#496-504' title='goto source code'>[src]</a></h4><div class='docblock'><p>Consumes the <code>BinaryHeap</code> and returns a vector in sorted
|
||
(ascending) order.</p>
|
||
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">7</span>]);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">6</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">3</span>);
|
||
|
||
<span class="kw">let</span> <span class="ident">vec</span> <span class="op">=</span> <span class="ident">heap</span>.<span class="ident">into_sorted_vec</span>();
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>]);</pre></div>
|
||
</div><h4 id='method.append' class="method"><code id='append.v'>pub fn <a href='#method.append' class='fnname'>append</a>(&mut self, other: &mut <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T>)</code><span class='since' title='Stable since Rust version 1.11.0'>1.11.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#611-641' title='goto source code'>[src]</a></h4><div class='docblock'><p>Moves all the elements of <code>other</code> into <code>self</code>, leaving <code>other</code> empty.</p>
|
||
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="op">-</span><span class="number">10</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>];
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="ident">v</span>);
|
||
|
||
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="op">-</span><span class="number">20</span>, <span class="number">5</span>, <span class="number">43</span>];
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="ident">v</span>);
|
||
|
||
<span class="ident">a</span>.<span class="ident">append</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">b</span>);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>.<span class="ident">into_sorted_vec</span>(), [<span class="op">-</span><span class="number">20</span>, <span class="op">-</span><span class="number">10</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">43</span>]);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">b</span>.<span class="ident">is_empty</span>());</pre></div>
|
||
</div><h4 id='method.drain_sorted' class="method"><code id='drain_sorted.v'>pub fn <a href='#method.drain_sorted' class='fnname'>drain_sorted</a>(&mut self) -> <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.DrainSorted.html" title="struct nom::lib::std::collections::binary_heap::DrainSorted">DrainSorted</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#667-669' title='goto source code'>[src]</a></h4><div class='stability'><div class='stab unstable'><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>binary_heap_drain_sorted</code>)</div></div><div class='docblock'><p>Returns an iterator which retrieves elements in heap order.
|
||
The retrieved elements are removed from the original heap.
|
||
The remaining elements will be removed on drop in heap order.</p>
|
||
<p>Note:</p>
|
||
<ul>
|
||
<li><code>.drain_sorted()</code> is O(n lg n); much slower than <code>.drain()</code>.
|
||
You should use the latter for most cases.</li>
|
||
</ul>
|
||
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">binary_heap_drain_sorted</span>)]</span>
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">len</span>(), <span class="number">5</span>);
|
||
|
||
<span class="ident">drop</span>(<span class="ident">heap</span>.<span class="ident">drain_sorted</span>()); <span class="comment">// removes all elements in heap order</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">len</span>(), <span class="number">0</span>);</pre></div>
|
||
</div></div><h3 id='impl-1' class='impl'><code class='in-band'>impl<T> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a href='#impl-1' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#672-960' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.iter' class="method"><code id='iter.v'>pub fn <a href='#method.iter' class='fnname'>iter</a>(&self) -> <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.Iter.html" title="struct nom::lib::std::collections::binary_heap::Iter">Iter</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#690-692' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an iterator visiting all values in the underlying vector, in
|
||
arbitrary order.</p>
|
||
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
||
|
||
<span class="comment">// Print 1, 2, 3, 4 in arbitrary order</span>
|
||
<span class="kw">for</span> <span class="ident">x</span> <span class="kw">in</span> <span class="ident">heap</span>.<span class="ident">iter</span>() {
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{}"</span>, <span class="ident">x</span>);
|
||
}</pre></div>
|
||
</div><h4 id='method.into_iter_sorted' class="method"><code id='into_iter_sorted.v'>pub fn <a href='#method.into_iter_sorted' class='fnname'>into_iter_sorted</a>(self) -> <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.IntoIterSorted.html" title="struct nom::lib::std::collections::binary_heap::IntoIterSorted">IntoIterSorted</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#709-711' title='goto source code'>[src]</a></h4><div class='stability'><div class='stab unstable'><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>binary_heap_into_iter_sorted</code>)</div></div><div class='docblock'><p>Returns an iterator which retrieves elements in heap order.
|
||
This method consumes the original heap.</p>
|
||
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">binary_heap_into_iter_sorted</span>)]</span>
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">into_iter_sorted</span>().<span class="ident">take</span>(<span class="number">2</span>).<span class="ident">collect</span>::<span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="kw">_</span><span class="op">></span><span class="op">></span>(), <span class="macro">vec</span><span class="macro">!</span>[<span class="number">5</span>, <span class="number">4</span>]);</pre></div>
|
||
</div><h4 id='method.peek' class="method"><code id='peek.v'>pub fn <a href='#method.peek' class='fnname'>peek</a>(&self) -> <a class="enum" href="../../../../nom/lib/std/prelude/v1/v1/enum.Option.html" title="enum nom::lib::std::prelude::v1::v1::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#735-737' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the greatest item in the binary heap, or <code>None</code> if it is empty.</p>
|
||
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek</span>(), <span class="prelude-val">None</span>);
|
||
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">1</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">5</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">2</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">peek</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">5</span>));
|
||
</pre></div>
|
||
<h1 id="time-complexity-4" class="section-header"><a href="#time-complexity-4">Time complexity</a></h1>
|
||
<p>Cost is O(1) in the worst case.</p>
|
||
</div><h4 id='method.capacity' class="method"><code id='capacity.v'>pub fn <a href='#method.capacity' class='fnname'>capacity</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#752-754' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the number of elements the binary heap can hold without reallocating.</p>
|
||
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">with_capacity</span>(<span class="number">100</span>);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">100</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">4</span>);</pre></div>
|
||
</div><h4 id='method.reserve_exact' class="method"><code id='reserve_exact.v'>pub fn <a href='#method.reserve_exact' class='fnname'>reserve_exact</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#781-783' title='goto source code'>[src]</a></h4><div class='docblock'><p>Reserves the minimum capacity for exactly <code>additional</code> more elements to be inserted in the
|
||
given <code>BinaryHeap</code>. Does nothing if the capacity is already sufficient.</p>
|
||
<p>Note that the allocator may give the collection more space than it requests. Therefore
|
||
capacity can not be relied upon to be precisely minimal. Prefer <a href="#method.reserve"><code>reserve</code></a> if future
|
||
insertions are expected.</p>
|
||
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
<span class="ident">heap</span>.<span class="ident">reserve_exact</span>(<span class="number">100</span>);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">100</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">4</span>);</pre></div>
|
||
</div><h4 id='method.reserve' class="method"><code id='reserve.v'>pub fn <a href='#method.reserve' class='fnname'>reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#804-806' title='goto source code'>[src]</a></h4><div class='docblock'><p>Reserves capacity for at least <code>additional</code> more elements to be inserted in the
|
||
<code>BinaryHeap</code>. The collection may reserve more space to avoid frequent reallocations.</p>
|
||
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
<span class="ident">heap</span>.<span class="ident">reserve</span>(<span class="number">100</span>);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">100</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">4</span>);</pre></div>
|
||
</div><h4 id='method.shrink_to_fit' class="method"><code id='shrink_to_fit.v'>pub fn <a href='#method.shrink_to_fit' class='fnname'>shrink_to_fit</a>(&mut self)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#823-825' title='goto source code'>[src]</a></h4><div class='docblock'><p>Discards as much additional capacity as possible.</p>
|
||
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span>: <span class="ident">BinaryHeap</span><span class="op"><</span><span class="ident">i32</span><span class="op">></span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">with_capacity</span>(<span class="number">100</span>);
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">100</span>);
|
||
<span class="ident">heap</span>.<span class="ident">shrink_to_fit</span>();
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);</pre></div>
|
||
</div><h4 id='method.shrink_to' class="method"><code id='shrink_to.v'>pub fn <a href='#method.shrink_to' class='fnname'>shrink_to</a>(&mut self, min_capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#848-850' title='goto source code'>[src]</a></h4><div class='stability'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>shrink_to</code>)</summary><p>new API</p>
|
||
</details></div></div><div class='docblock'><p>Discards capacity with a lower bound.</p>
|
||
<p>The capacity will remain at least as large as both the length
|
||
and the supplied value.</p>
|
||
<p>Panics if the current capacity is smaller than the supplied
|
||
minimum capacity.</p>
|
||
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">shrink_to</span>)]</span>
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span>: <span class="ident">BinaryHeap</span><span class="op"><</span><span class="ident">i32</span><span class="op">></span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">with_capacity</span>(<span class="number">100</span>);
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">100</span>);
|
||
<span class="ident">heap</span>.<span class="ident">shrink_to</span>(<span class="number">10</span>);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">10</span>);</pre></div>
|
||
</div><h4 id='method.into_vec' class="method"><code id='into_vec.v'>pub fn <a href='#method.into_vec' class='fnname'>into_vec</a>(self) -> <a class="struct" href="../../../../nom/lib/std/prelude/v1/v1/struct.Vec.html" title="struct nom::lib::std::prelude::v1::v1::Vec">Vec</a><T></code><span class='since' title='Stable since Rust version 1.5.0'>1.5.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#870-872' title='goto source code'>[src]</a></h4><div class='docblock'><p>Consumes the <code>BinaryHeap</code> and returns the underlying vector
|
||
in arbitrary order.</p>
|
||
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>]);
|
||
<span class="kw">let</span> <span class="ident">vec</span> <span class="op">=</span> <span class="ident">heap</span>.<span class="ident">into_vec</span>();
|
||
|
||
<span class="comment">// Will print in some order</span>
|
||
<span class="kw">for</span> <span class="ident">x</span> <span class="kw">in</span> <span class="ident">vec</span> {
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{}"</span>, <span class="ident">x</span>);
|
||
}</pre></div>
|
||
</div><h4 id='method.len' class="method"><code id='len.v'>pub fn <a href='#method.len' class='fnname'>len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#887-889' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the length of the binary heap.</p>
|
||
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">3</span>]);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">len</span>(), <span class="number">2</span>);</pre></div>
|
||
</div><h4 id='method.is_empty' class="method"><code id='is_empty.v'>pub fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#910-912' title='goto source code'>[src]</a></h4><div class='docblock'><p>Checks if the binary heap is empty.</p>
|
||
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">new</span>();
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">is_empty</span>());
|
||
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">3</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">5</span>);
|
||
<span class="ident">heap</span>.<span class="ident">push</span>(<span class="number">1</span>);
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">heap</span>.<span class="ident">is_empty</span>());</pre></div>
|
||
</div><h4 id='method.drain' class="method"><code id='drain.v'>pub fn <a href='#method.drain' class='fnname'>drain</a>(&mut self) -> <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.Drain.html" title="struct nom::lib::std::collections::binary_heap::Drain">Drain</a><T></code><span class='since' title='Stable since Rust version 1.6.0'>1.6.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#936-938' title='goto source code'>[src]</a></h4><div class='docblock'><p>Clears the binary heap, returning an iterator over the removed elements.</p>
|
||
<p>The elements are removed in arbitrary order.</p>
|
||
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">3</span>]);
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">heap</span>.<span class="ident">is_empty</span>());
|
||
|
||
<span class="kw">for</span> <span class="ident">x</span> <span class="kw">in</span> <span class="ident">heap</span>.<span class="ident">drain</span>() {
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{}"</span>, <span class="ident">x</span>);
|
||
}
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">is_empty</span>());</pre></div>
|
||
</div><h4 id='method.clear' class="method"><code id='clear.v'>pub fn <a href='#method.clear' class='fnname'>clear</a>(&mut self)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#957-959' title='goto source code'>[src]</a></h4><div class='docblock'><p>Drops all items from the binary heap.</p>
|
||
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">3</span>]);
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">heap</span>.<span class="ident">is_empty</span>());
|
||
|
||
<span class="ident">heap</span>.<span class="ident">clear</span>();
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">heap</span>.<span class="ident">is_empty</span>());</pre></div>
|
||
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html" title="trait nom::lib::std::prelude::v1::v1::Clone">Clone</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html" title="trait nom::lib::std::prelude::v1::v1::Clone">Clone</a>, </span></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#313-321' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#314-316' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &<a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T>)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#318-320' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html#method.clone_from">Read more</a></p>
|
||
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/fmt/trait.Debug.html" title="trait nom::lib::std::fmt::Debug">Debug</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/fmt/trait.Debug.html" title="trait nom::lib::std::fmt::Debug">Debug</a>, </span></code><a href='#impl-Debug' class='anchor'></a><span class='since' title='Stable since Rust version 1.4.0'>1.4.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#333-337' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='../../../../nom/lib/std/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="../../../../nom/lib/std/fmt/struct.Formatter.html" title="struct nom::lib::std::fmt::Formatter">Formatter</a>) -> <a class="enum" href="../../../../nom/lib/std/prelude/v1/v1/enum.Result.html" title="enum nom::lib::std::prelude::v1::v1::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="../../../../nom/lib/std/fmt/struct.Error.html" title="struct nom::lib::std::fmt::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#334-336' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="../../../../nom/lib/std/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||
</div></div><h3 id='impl-Default' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Default.html" title="trait nom::lib::std::prelude::v1::v1::Default">Default</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Ord.html" title="trait nom::lib::std::prelude::v1::v1::Ord">Ord</a>, </span></code><a href='#impl-Default' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#324-330' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.default' class="method"><code id='default.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.Default.html#tymethod.default' class='fnname'>default</a>() -> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#327-329' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an empty <code>BinaryHeap<T></code>.</p>
|
||
</div></div><h3 id='impl-Extend%3C%26%27a%20T%3E' class='impl'><code class='in-band'>impl<'a, T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Extend.html" title="trait nom::lib::std::prelude::v1::v1::Extend">Extend</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: 'a + <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Ord.html" title="trait nom::lib::std::prelude::v1::v1::Ord">Ord</a> + <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Copy.html" title="trait nom::lib::std::prelude::v1::v1::Copy">Copy</a>, </span></code><a href='#impl-Extend%3C%26%27a%20T%3E' class='anchor'></a><span class='since' title='Stable since Rust version 1.2.0'>1.2.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1379-1383' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.extend' class="method hidden"><code id='extend.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.Extend.html#tymethod.extend' class='fnname'>extend</a><I>(&mut self, iter: I) <span class="where fmt-newline">where<br> I: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html" title="trait nom::lib::std::prelude::v1::v1::IntoIterator">IntoIterator</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T>, </span></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1380-1382' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Extends a collection with the contents of an iterator. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.Extend.html#tymethod.extend">Read more</a></p>
|
||
</div></div><h3 id='impl-Extend%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Extend.html" title="trait nom::lib::std::prelude::v1::v1::Extend">Extend</a><T> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Ord.html" title="trait nom::lib::std::prelude::v1::v1::Ord">Ord</a>, </span></code><a href='#impl-Extend%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1348-1353' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.extend-1' class="method hidden"><code id='extend.v-1'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.Extend.html#tymethod.extend' class='fnname'>extend</a><I>(&mut self, iter: I) <span class="where fmt-newline">where<br> I: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html" title="trait nom::lib::std::prelude::v1::v1::IntoIterator">IntoIterator</a><Item = T>, </span></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1350-1352' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Extends a collection with the contents of an iterator. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.Extend.html#tymethod.extend">Read more</a></p>
|
||
</div></div><h3 id='impl-From%3CBinaryHeap%3CT%3E%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.From.html" title="trait nom::lib::std::prelude::v1::v1::From">From</a><<a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T>> for <a class="struct" href="../../../../nom/lib/std/prelude/v1/v1/struct.Vec.html" title="struct nom::lib::std::prelude::v1::v1::Vec">Vec</a><T></code><a href='#impl-From%3CBinaryHeap%3CT%3E%3E' class='anchor'></a><span class='since' title='Stable since Rust version 1.5.0'>1.5.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1296-1300' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.From.html#tymethod.from' class='fnname'>from</a>(heap: <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T>) -> <a class="struct" href="../../../../nom/lib/std/prelude/v1/v1/struct.Vec.html" title="struct nom::lib::std::prelude::v1::v1::Vec">Vec</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1297-1299' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-From%3CVec%3CT%3E%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.From.html" title="trait nom::lib::std::prelude::v1::v1::From">From</a><<a class="struct" href="../../../../nom/lib/std/prelude/v1/v1/struct.Vec.html" title="struct nom::lib::std::prelude::v1::v1::Vec">Vec</a><T>> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Ord.html" title="trait nom::lib::std::prelude::v1::v1::Ord">Ord</a>, </span></code><a href='#impl-From%3CVec%3CT%3E%3E' class='anchor'></a><span class='since' title='Stable since Rust version 1.5.0'>1.5.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1284-1293' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-1' class="method"><code id='from.v-1'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.From.html#tymethod.from' class='fnname'>from</a>(vec: <a class="struct" href="../../../../nom/lib/std/prelude/v1/v1/struct.Vec.html" title="struct nom::lib::std::prelude::v1::v1::Vec">Vec</a><T>) -> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1288-1292' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>Vec<T></code> into a <code>BinaryHeap<T></code>.</p>
|
||
<p>This conversion happens in-place, and has <code>O(n)</code> time complexity.</p>
|
||
</div></div><h3 id='impl-FromIterator%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/iter/trait.FromIterator.html" title="trait nom::lib::std::iter::FromIterator">FromIterator</a><T> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Ord.html" title="trait nom::lib::std::prelude::v1::v1::Ord">Ord</a>, </span></code><a href='#impl-FromIterator%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1303-1307' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from_iter' class="method hidden"><code id='from_iter.v'>fn <a href='../../../../nom/lib/std/iter/trait.FromIterator.html#tymethod.from_iter' class='fnname'>from_iter</a><I>(iter: I) -> <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> I: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html" title="trait nom::lib::std::prelude::v1::v1::IntoIterator">IntoIterator</a><Item = T>, </span></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1304-1306' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates a value from an iterator. <a href="../../../../nom/lib/std/iter/trait.FromIterator.html#tymethod.from_iter">Read more</a></p>
|
||
</div></div><h3 id='impl-IntoIterator' class='impl'><code class='in-band'>impl<'a, T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html" title="trait nom::lib::std::prelude::v1::v1::IntoIterator">IntoIterator</a> for &'a <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a href='#impl-IntoIterator' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1338-1345' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Item' class="type"><code id='Item.t'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T</code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
|
||
</div><h4 id='associatedtype.IntoIter' class="type"><code id='IntoIter.t'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.Iter.html" title="struct nom::lib::std::collections::binary_heap::Iter">Iter</a><'a, T></code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
||
</div><h4 id='method.into_iter' class="method hidden"><code id='into_iter.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.Iter.html" title="struct nom::lib::std::collections::binary_heap::Iter">Iter</a><'a, T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1342-1344' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
||
</div></div><h3 id='impl-IntoIterator-1' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html" title="trait nom::lib::std::prelude::v1::v1::IntoIterator">IntoIterator</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T></code><a href='#impl-IntoIterator-1' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1310-1335' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Item-1' class="type"><code id='Item.t-1'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = T</code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
|
||
</div><h4 id='associatedtype.IntoIter-1' class="type"><code id='IntoIter.t-1'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.IntoIter.html" title="struct nom::lib::std::collections::binary_heap::IntoIter">IntoIter</a><T></code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
||
</div><h4 id='method.into_iter-1' class="method"><code id='into_iter.v-1'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> <a class="struct" href="../../../../nom/lib/std/collections/binary_heap/struct.IntoIter.html" title="struct nom::lib::std::collections::binary_heap::IntoIter">IntoIter</a><T></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/collections/binary_heap.rs.html#1332-1334' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a consuming iterator, that is, one that moves each value out of
|
||
the binary heap in arbitrary order. The binary heap cannot be used
|
||
after calling this.</p>
|
||
<h1 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">BinaryHeap</span>;
|
||
<span class="kw">let</span> <span class="ident">heap</span> <span class="op">=</span> <span class="ident">BinaryHeap</span>::<span class="ident">from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
||
|
||
<span class="comment">// Print 1, 2, 3, 4 in arbitrary order</span>
|
||
<span class="kw">for</span> <span class="ident">x</span> <span class="kw">in</span> <span class="ident">heap</span>.<span class="ident">into_iter</span>() {
|
||
<span class="comment">// x has type i32, not &i32</span>
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{}"</span>, <span class="ident">x</span>);
|
||
}</pre></div>
|
||
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a>, </span></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Send.html" title="trait nom::lib::std::prelude::v1::v1::Send">Send</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Send.html" title="trait nom::lib::std::prelude::v1::v1::Send">Send</a>, </span></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Sync.html" title="trait nom::lib::std::prelude::v1::v1::Sync">Sync</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Sync.html" title="trait nom::lib::std::prelude::v1::v1::Sync">Sync</a>, </span></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Unpin.html" title="trait nom::lib::std::prelude::v1::v1::Unpin">Unpin</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Unpin.html" title="trait nom::lib::std::prelude::v1::v1::Unpin">Unpin</a>, </span></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../../../nom/lib/std/collections/struct.BinaryHeap.html" title="struct nom::lib::std::collections::BinaryHeap">BinaryHeap</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a>, </span></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Sized.html" title="trait nom::lib::std::prelude::v1::v1::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Sized.html" title="trait nom::lib::std::prelude::v1::v1::Sized">Sized</a>, </span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Sized.html" title="trait nom::lib::std::prelude::v1::v1::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.From.html" title="trait nom::lib::std::prelude::v1::v1::From">From</a><T> for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#564-568' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-2' class="method hidden"><code id='from.v-2'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-567' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Into.html" title="trait nom::lib::std::prelude::v1::v1::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.From.html" title="trait nom::lib::std::prelude::v1::v1::From">From</a><T>, </span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#553-560' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#557-559' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-IntoIterator-2' class='impl'><code class='in-band'>impl<I> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html" title="trait nom::lib::std::prelude::v1::v1::IntoIterator">IntoIterator</a> for I <span class="where fmt-newline">where<br> I: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Iterator.html" title="trait nom::lib::std::prelude::v1::v1::Iterator">Iterator</a>, </span></code><a href='#impl-IntoIterator-2' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#243-250' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Item-2' class="type"><code id='Item.t-2'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <I as <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Iterator.html" title="trait nom::lib::std::prelude::v1::v1::Iterator">Iterator</a>>::<a class="type" href="../../../../nom/lib/std/prelude/v1/v1/trait.Iterator.html#associatedtype.Item" title="type nom::lib::std::prelude::v1::v1::Iterator::Item">Item</a></code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
|
||
</div><h4 id='associatedtype.IntoIter-2' class="type"><code id='IntoIter.t-2'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = I</code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
||
</div><h4 id='method.into_iter-2' class="method hidden"><code id='into_iter.v-2'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> I</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#247-249' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
||
</div></div><h3 id='impl-ToOwned' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.ToOwned.html" title="trait nom::lib::std::prelude::v1::v1::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Clone.html" title="trait nom::lib::std::prelude::v1::v1::Clone">Clone</a>, </span></code><a href='#impl-ToOwned' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#80-92' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Owned' class="type"><code id='Owned.t'>type <a href='../../../../nom/lib/std/prelude/v1/v1/trait.ToOwned.html#associatedtype.Owned' class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||
</div><h4 id='method.to_owned' class="method hidden"><code id='to_owned.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.ToOwned.html#tymethod.to_owned' class='fnname'>to_owned</a>(&self) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85-87' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||
</div><h4 id='method.clone_into' class="method hidden"><code id='clone_into.v'>fn <a href='../../../../nom/lib/std/prelude/v1/v1/trait.ToOwned.html#method.clone_into' class='fnname'>clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='stability hidden'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="../../../../nom/lib/std/prelude/v1/v1/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="../../../../nom/lib/std/convert/trait.TryFrom.html" title="trait nom::lib::std::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="../../../../nom/lib/std/prelude/v1/v1/trait.Into.html" title="trait nom::lib::std::prelude::v1::v1::Into">Into</a><T>, </span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#601-610' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='../../../../nom/lib/std/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="../../../../nom/lib/std/convert/enum.Infallible.html" title="enum nom::lib::std::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='../../../../nom/lib/std/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -> <a class="enum" href="../../../../nom/lib/std/prelude/v1/v1/enum.Result.html" title="enum nom::lib::std::prelude::v1::v1::Result">Result</a><T, <T as <a class="trait" href="../../../../nom/lib/std/convert/trait.TryFrom.html" title="trait nom::lib::std::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="../../../../nom/lib/std/convert/trait.TryFrom.html#associatedtype.Error" title="type nom::lib::std::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#607-609' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="../../../../nom/lib/std/convert/trait.TryInto.html" title="trait nom::lib::std::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="../../../../nom/lib/std/convert/trait.TryFrom.html" title="trait nom::lib::std::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#587-596' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='../../../../nom/lib/std/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = <U as <a class="trait" href="../../../../nom/lib/std/convert/trait.TryFrom.html" title="trait nom::lib::std::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="../../../../nom/lib/std/convert/trait.TryFrom.html#associatedtype.Error" title="type nom::lib::std::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='../../../../nom/lib/std/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -> <a class="enum" href="../../../../nom/lib/std/prelude/v1/v1/enum.Result.html" title="enum nom::lib::std::prelude::v1::v1::Result">Result</a><U, <U as <a class="trait" href="../../../../nom/lib/std/convert/trait.TryFrom.html" title="trait nom::lib::std::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="../../../../nom/lib/std/convert/trait.TryFrom.html#associatedtype.Error" title="type nom::lib::std::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#593-595' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../../";window.currentCrate = "nom";</script><script src="../../../../aliases.js"></script><script src="../../../../main.js"></script><script defer src="../../../../search-index.js"></script></body></html> |