Files
iroh/pr/3145/docs/iroh_net_report/task/struct.JoinSet.html
T

284 lines
65 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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 collection of tasks spawned on a Tokio runtime."><title>JoinSet in iroh_net_report::task - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net_report" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.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="../../iroh_net_report/index.html">iroh_<wbr>net_<wbr>report</a><span class="version">0.31.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">JoinSet</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><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.abort_all" title="abort_all">abort_all</a></li><li><a href="#method.detach_all" title="detach_all">detach_all</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.join_all" title="join_all">join_all</a></li><li><a href="#method.join_next" title="join_next">join_next</a></li><li><a href="#method.join_next_with_id" title="join_next_with_id">join_next_with_id</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.poll_join_next" title="poll_join_next">poll_join_next</a></li><li><a href="#method.poll_join_next_with_id" title="poll_join_next_with_id">poll_join_next_with_id</a></li><li><a href="#method.shutdown" title="shutdown">shutdown</a></li><li><a href="#method.spawn" title="spawn">spawn</a></li><li><a href="#method.spawn_blocking" title="spawn_blocking">spawn_blocking</a></li><li><a href="#method.spawn_blocking_on" title="spawn_blocking_on">spawn_blocking_on</a></li><li><a href="#method.spawn_local" title="spawn_local">spawn_local</a></li><li><a href="#method.spawn_local_on" title="spawn_local_on">spawn_local_on</a></li><li><a href="#method.spawn_on" title="spawn_on">spawn_on</a></li><li><a href="#method.try_join_next" title="try_join_next">try_join_next</a></li><li><a href="#method.try_join_next_with_id" title="try_join_next_with_id">try_join_next_with_id</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-JoinSet%3CT%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-JoinSet%3CT%3E" title="Default">Default</a></li><li><a href="#impl-Drop-for-JoinSet%3CT%3E" title="Drop">Drop</a></li><li><a href="#impl-FromIterator%3CF%3E-for-JoinSet%3CT%3E" title="FromIterator&#60;F&#62;">FromIterator&#60;F&#62;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-JoinSet%3CT%3E" title="!RefUnwindSafe">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-JoinSet%3CT%3E" title="!UnwindSafe">!UnwindSafe</a></li><li><a href="#impl-Freeze-for-JoinSet%3CT%3E" title="Freeze">Freeze</a></li><li><a href="#impl-Send-for-JoinSet%3CT%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-JoinSet%3CT%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-JoinSet%3CT%3E" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-AsTaggedExplicit%3C'a,+E%3E-for-T" title="AsTaggedExplicit&#60;&#39;a, E&#62;">AsTaggedExplicit&#60;&#39;a, E&#62;</a></li><li><a href="#impl-AsTaggedImplicit%3C'a,+E%3E-for-T" title="AsTaggedImplicit&#60;&#39;a, E&#62;">AsTaggedImplicit&#60;&#39;a, E&#62;</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-ErasedDestructor-for-T" title="ErasedDestructor">ErasedDestructor</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Instrument-for-T" title="Instrument">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</a></li><li><a href="#impl-MaybeSendSync-for-T" title="MaybeSendSync">MaybeSendSync</a></li><li><a href="#impl-Pointable-for-T" title="Pointable">Pointable</a></li><li><a href="#impl-Same-for-T" title="Same">Same</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li><li><a href="#impl-VZip%3CV%3E-for-T" title="VZip&#60;V&#62;">VZip&#60;V&#62;</a></li><li><a href="#impl-WithSubscriber-for-T" title="WithSubscriber">WithSubscriber</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>net_<wbr>report::<wbr>task</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_net_report</a>::<wbr><a href="index.html">task</a></span><h1>Struct <span class="struct">JoinSet</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub struct JoinSet&lt;T&gt; { <span class="comment">/* private fields */</span> }</code></pre><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A collection of tasks spawned on a Tokio runtime.</p>
<p>A <code>JoinSet</code> can be used to await the completion of some or all of the tasks
in the set. The set is not ordered, and the tasks will be returned in the
order they complete.</p>
<p>All of the tasks must have the same return type <code>T</code>.</p>
<p>When the <code>JoinSet</code> is dropped, all tasks in the <code>JoinSet</code> are immediately aborted.</p>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<p>Spawn multiple tasks and wait for them.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task::JoinSet;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() {
<span class="kw">let </span><span class="kw-2">mut </span>set = JoinSet::new();
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
set.spawn(<span class="kw">async move </span>{ i });
}
<span class="kw">let </span><span class="kw-2">mut </span>seen = [<span class="bool-val">false</span>; <span class="number">10</span>];
<span class="kw">while let </span><span class="prelude-val">Some</span>(res) = set.join_next().<span class="kw">await </span>{
<span class="kw">let </span>idx = res.unwrap();
seen[idx] = <span class="bool-val">true</span>;
}
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
<span class="macro">assert!</span>(seen[i]);
}
}</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-JoinSet%3CT%3E" class="impl"><a href="#impl-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Create a new <code>JoinSet</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of tasks currently in the <code>JoinSet</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns whether the <code>JoinSet</code> is empty.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-JoinSet%3CT%3E-1" class="impl"><a href="#impl-JoinSet%3CT%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;<div class="where">where
T: 'static,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.spawn" class="method"><h4 class="code-header">pub fn <a href="#method.spawn" class="fn">spawn</a>&lt;F&gt;(&amp;mut self, task: F) -&gt; AbortHandle<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = T&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h4></section></summary><div class="docblock"><p>Spawn the provided task on the <code>JoinSet</code>, returning an <a href="crate::task::AbortHandle"><code>AbortHandle</code></a>
that can be used to remotely cancel the task.</p>
<p>The provided future will start running in the background immediately
when this method is called, even if you don’t await anything on this
<code>JoinSet</code>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>This method panics if called outside of a Tokio runtime.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_on" class="method"><h4 class="code-header">pub fn <a href="#method.spawn_on" class="fn">spawn_on</a>&lt;F&gt;(&amp;mut self, task: F, handle: &amp;Handle) -&gt; AbortHandle<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = T&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h4></section></summary><div class="docblock"><p>Spawn the provided task on the provided runtime and store it in this
<code>JoinSet</code> returning an <a href="crate::task::AbortHandle"><code>AbortHandle</code></a> that can be used to remotely
cancel the task.</p>
<p>The provided future will start running in the background immediately
when this method is called, even if you don’t await anything on this
<code>JoinSet</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_local" class="method"><h4 class="code-header">pub fn <a href="#method.spawn_local" class="fn">spawn_local</a>&lt;F&gt;(&amp;mut self, task: F) -&gt; AbortHandle<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = T&gt; + 'static,</div></h4></section></summary><div class="docblock"><p>Spawn the provided task on the current <a href="crate::task::LocalSet"><code>LocalSet</code></a> and store it in this
<code>JoinSet</code>, returning an <a href="crate::task::AbortHandle"><code>AbortHandle</code></a> that can be used to remotely
cancel the task.</p>
<p>The provided future will start running in the background immediately
when this method is called, even if you don’t await anything on this
<code>JoinSet</code>.</p>
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
<p>This method panics if it is called outside of a <code>LocalSet</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_local_on" class="method"><h4 class="code-header">pub fn <a href="#method.spawn_local_on" class="fn">spawn_local_on</a>&lt;F&gt;(
&amp;mut self,
task: F,
local_set: &amp;LocalSet,
) -&gt; AbortHandle<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = T&gt; + 'static,</div></h4></section></summary><div class="docblock"><p>Spawn the provided task on the provided <a href="crate::task::LocalSet"><code>LocalSet</code></a> and store it in
this <code>JoinSet</code>, returning an <a href="crate::task::AbortHandle"><code>AbortHandle</code></a> that can be used to
remotely cancel the task.</p>
<p>Unlike the <a href="struct.JoinSet.html#method.spawn_local" title="method iroh_net_report::task::JoinSet::spawn_local"><code>spawn_local</code></a> method, this method may be used to spawn local
tasks on a <code>LocalSet</code> that is <em>not</em> currently running. The provided
future will start running whenever the <code>LocalSet</code> is next started.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_blocking" class="method"><h4 class="code-header">pub fn <a href="#method.spawn_blocking" class="fn">spawn_blocking</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; AbortHandle<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>() -&gt; T + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h4></section></summary><div class="docblock"><p>Spawn the blocking code on the blocking threadpool and store
it in this <code>JoinSet</code>, returning an <a href="crate::task::AbortHandle"><code>AbortHandle</code></a> that can be
used to remotely cancel the task.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<p>Spawn multiple blocking tasks and wait for them.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task::JoinSet;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() {
<span class="kw">let </span><span class="kw-2">mut </span>set = JoinSet::new();
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
set.spawn_blocking(<span class="kw">move </span>|| { i });
}
<span class="kw">let </span><span class="kw-2">mut </span>seen = [<span class="bool-val">false</span>; <span class="number">10</span>];
<span class="kw">while let </span><span class="prelude-val">Some</span>(res) = set.join_next().<span class="kw">await </span>{
<span class="kw">let </span>idx = res.unwrap();
seen[idx] = <span class="bool-val">true</span>;
}
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
<span class="macro">assert!</span>(seen[i]);
}
}</code></pre></div>
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5>
<p>This method panics if called outside of a Tokio runtime.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_blocking_on" class="method"><h4 class="code-header">pub fn <a href="#method.spawn_blocking_on" class="fn">spawn_blocking_on</a>&lt;F&gt;(&amp;mut self, f: F, handle: &amp;Handle) -&gt; AbortHandle<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>() -&gt; T + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h4></section></summary><div class="docblock"><p>Spawn the blocking code on the blocking threadpool of the
provided runtime and store it in this <code>JoinSet</code>, returning an
<a href="crate::task::AbortHandle"><code>AbortHandle</code></a> that can be used to remotely cancel the task.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.join_next" class="method"><h4 class="code-header">pub async fn <a href="#method.join_next" class="fn">join_next</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError">JoinError</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Waits until one of the tasks in the set completes and returns its output.</p>
<p>Returns <code>None</code> if the set is empty.</p>
<h5 id="cancel-safety"><a class="doc-anchor" href="#cancel-safety">§</a>Cancel Safety</h5>
<p>This method is cancel safe. If <code>join_next</code> is used as the event in a <code>tokio::select!</code>
statement and some other branch completes first, it is guaranteed that no tasks were
removed from this <code>JoinSet</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.join_next_with_id" class="method"><h4 class="code-header">pub async fn <a href="#method.join_next_with_id" class="fn">join_next_with_id</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(Id, T), <a class="struct" href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError">JoinError</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Waits until one of the tasks in the set completes and returns its
output, along with the <a href="crate::task::Id">task ID</a> of the completed task.</p>
<p>Returns <code>None</code> if the set is empty.</p>
<p>When this method returns an error, then the id of the task that failed can be accessed
using the <a href="struct.JoinError.html#method.id" title="method iroh_net_report::task::JoinError::id"><code>JoinError::id</code></a> method.</p>
<h5 id="cancel-safety-1"><a class="doc-anchor" href="#cancel-safety-1">§</a>Cancel Safety</h5>
<p>This method is cancel safe. If <code>join_next_with_id</code> is used as the event in a <code>tokio::select!</code>
statement and some other branch completes first, it is guaranteed that no tasks were
removed from this <code>JoinSet</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_join_next" class="method"><h4 class="code-header">pub fn <a href="#method.try_join_next" class="fn">try_join_next</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError">JoinError</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Tries to join one of the tasks in the set that has completed and return its output.</p>
<p>Returns <code>None</code> if there are no completed tasks, or if the set is empty.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_join_next_with_id" class="method"><h4 class="code-header">pub fn <a href="#method.try_join_next_with_id" class="fn">try_join_next_with_id</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(Id, T), <a class="struct" href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError">JoinError</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Tries to join one of the tasks in the set that has completed and return its output,
along with the <a href="crate::task::Id">task ID</a> of the completed task.</p>
<p>Returns <code>None</code> if there are no completed tasks, or if the set is empty.</p>
<p>When this method returns an error, then the id of the task that failed can be accessed
using the <a href="struct.JoinError.html#method.id" title="method iroh_net_report::task::JoinError::id"><code>JoinError::id</code></a> method.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.shutdown" class="method"><h4 class="code-header">pub async fn <a href="#method.shutdown" class="fn">shutdown</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Aborts all tasks and waits for them to finish shutting down.</p>
<p>Calling this method is equivalent to calling <a href="struct.JoinSet.html#method.abort_all" title="method iroh_net_report::task::JoinSet::abort_all"><code>abort_all</code></a> and then calling <a href="struct.JoinSet.html#method.join_next" title="method iroh_net_report::task::JoinSet::join_next"><code>join_next</code></a> in
a loop until it returns <code>None</code>.</p>
<p>This method ignores any panics in the tasks shutting down. When this call returns, the
<code>JoinSet</code> will be empty.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.join_all" class="method"><h4 class="code-header">pub async fn <a href="#method.join_all" class="fn">join_all</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Awaits the completion of all tasks in this <code>JoinSet</code>, returning a vector of their results.</p>
<p>The results will be stored in the order they completed not the order they were spawned.
This is a convenience method that is equivalent to calling <a href="struct.JoinSet.html#method.join_next" title="method iroh_net_report::task::JoinSet::join_next"><code>join_next</code></a> in
a loop. If any tasks on the <code>JoinSet</code> fail with an <a href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError"><code>JoinError</code></a>, then this call
to <code>join_all</code> will panic and all remaining tasks on the <code>JoinSet</code> are
cancelled. To handle errors in any other way, manually call <a href="struct.JoinSet.html#method.join_next" title="method iroh_net_report::task::JoinSet::join_next"><code>join_next</code></a>
in a loop.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<p>Spawn multiple tasks and <code>join_all</code> them.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task::JoinSet;
<span class="kw">use </span>std::time::Duration;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() {
<span class="kw">let </span><span class="kw-2">mut </span>set = JoinSet::new();
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">3 </span>{
set.spawn(<span class="kw">async move </span>{
tokio::time::sleep(Duration::from_secs(<span class="number">3 </span>- i)).<span class="kw">await</span>;
i
});
}
<span class="kw">let </span>output = set.join_all().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(output, <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">1</span>, <span class="number">0</span>]);
}</code></pre></div>
<p>Equivalent implementation of <code>join_all</code>, using <a href="struct.JoinSet.html#method.join_next" title="method iroh_net_report::task::JoinSet::join_next"><code>join_next</code></a> and loop.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task::JoinSet;
<span class="kw">use </span>std::panic;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() {
<span class="kw">let </span><span class="kw-2">mut </span>set = JoinSet::new();
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">3 </span>{
set.spawn(<span class="kw">async move </span>{i});
}
<span class="kw">let </span><span class="kw-2">mut </span>output = Vec::new();
<span class="kw">while let </span><span class="prelude-val">Some</span>(res) = set.join_next().<span class="kw">await</span>{
<span class="kw">match </span>res {
<span class="prelude-val">Ok</span>(t) =&gt; output.push(t),
<span class="prelude-val">Err</span>(err) <span class="kw">if </span>err.is_panic() =&gt; panic::resume_unwind(err.into_panic()),
<span class="prelude-val">Err</span>(err) =&gt; <span class="macro">panic!</span>(<span class="string">"{err}"</span>),
}
}
<span class="macro">assert_eq!</span>(output.len(),<span class="number">3</span>);
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.abort_all" class="method"><h4 class="code-header">pub fn <a href="#method.abort_all" class="fn">abort_all</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Aborts all tasks on this <code>JoinSet</code>.</p>
<p>This does not remove the tasks from the <code>JoinSet</code>. To wait for the tasks to complete
cancellation, you should call <code>join_next</code> in a loop until the <code>JoinSet</code> is empty.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.detach_all" class="method"><h4 class="code-header">pub fn <a href="#method.detach_all" class="fn">detach_all</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Removes all tasks from this <code>JoinSet</code> without aborting them.</p>
<p>The tasks removed by this call will continue to run in the background even if the <code>JoinSet</code>
is dropped.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.poll_join_next" class="method"><h4 class="code-header">pub fn <a href="#method.poll_join_next" class="fn">poll_join_next</a>(
&amp;mut self,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError">JoinError</a>&gt;&gt;&gt;</h4></section></summary><div class="docblock"><p>Polls for one of the tasks in the set to complete.</p>
<p>If this returns <code>Poll::Ready(Some(_))</code>, then the task that completed is removed from the set.</p>
<p>When the method returns <code>Poll::Pending</code>, the <code>Waker</code> in the provided <code>Context</code> is scheduled
to receive a wakeup when a task in the <code>JoinSet</code> completes. Note that on multiple calls to
<code>poll_join_next</code>, only the <code>Waker</code> from the <code>Context</code> passed to the most recent call is
scheduled to receive a wakeup.</p>
<h5 id="returns"><a class="doc-anchor" href="#returns">§</a>Returns</h5>
<p>This function returns:</p>
<ul>
<li><code>Poll::Pending</code> if the <code>JoinSet</code> is not empty but there is no task whose output is
available right now.</li>
<li><code>Poll::Ready(Some(Ok(value)))</code> if one of the tasks in this <code>JoinSet</code> has completed.
The <code>value</code> is the return value of one of the tasks that completed.</li>
<li><code>Poll::Ready(Some(Err(err)))</code> if one of the tasks in this <code>JoinSet</code> has panicked or been
aborted. The <code>err</code> is the <code>JoinError</code> from the panicked/aborted task.</li>
<li><code>Poll::Ready(None)</code> if the <code>JoinSet</code> is empty.</li>
</ul>
<p>Note that this method may return <code>Poll::Pending</code> even if one of the tasks has completed.
This can happen if the <a href="crate::task#cooperative-scheduling">coop budget</a> is reached.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.poll_join_next_with_id" class="method"><h4 class="code-header">pub fn <a href="#method.poll_join_next_with_id" class="fn">poll_join_next_with_id</a>(
&amp;mut self,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(Id, T), <a class="struct" href="struct.JoinError.html" title="struct iroh_net_report::task::JoinError">JoinError</a>&gt;&gt;&gt;</h4></section></summary><div class="docblock"><p>Polls for one of the tasks in the set to complete.</p>
<p>If this returns <code>Poll::Ready(Some(_))</code>, then the task that completed is removed from the set.</p>
<p>When the method returns <code>Poll::Pending</code>, the <code>Waker</code> in the provided <code>Context</code> is scheduled
to receive a wakeup when a task in the <code>JoinSet</code> completes. Note that on multiple calls to
<code>poll_join_next</code>, only the <code>Waker</code> from the <code>Context</code> passed to the most recent call is
scheduled to receive a wakeup.</p>
<h5 id="returns-1"><a class="doc-anchor" href="#returns-1">§</a>Returns</h5>
<p>This function returns:</p>
<ul>
<li><code>Poll::Pending</code> if the <code>JoinSet</code> is not empty but there is no task whose output is
available right now.</li>
<li><code>Poll::Ready(Some(Ok((id, value))))</code> if one of the tasks in this <code>JoinSet</code> has completed.
The <code>value</code> is the return value of one of the tasks that completed, and
<code>id</code> is the <a href="crate::task::Id">task ID</a> of that task.</li>
<li><code>Poll::Ready(Some(Err(err)))</code> if one of the tasks in this <code>JoinSet</code> has panicked or been
aborted. The <code>err</code> is the <code>JoinError</code> from the panicked/aborted task.</li>
<li><code>Poll::Ready(None)</code> if the <code>JoinSet</code> is empty.</li>
</ul>
<p>Note that this method may return <code>Poll::Pending</code> even if one of the tasks has completed.
This can happen if the <a href="crate::task#cooperative-scheduling">coop budget</a> is reached.</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-Debug-for-JoinSet%3CT%3E" class="impl"><a href="#impl-Debug-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/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-JoinSet%3CT%3E" class="impl"><a href="#impl-Default-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-JoinSet%3CT%3E" class="impl"><a href="#impl-Drop-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&amp;mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromIterator%3CF%3E-for-JoinSet%3CT%3E" class="impl"><a href="#impl-FromIterator%3CF%3E-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, F&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a>&lt;F&gt; for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = T&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</div></h3></section></summary><div class="docblock"><p>Collect an iterator of futures into a <a href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet"><code>JoinSet</code></a>.</p>
<p>This is equivalent to calling <a href="struct.JoinSet.html#method.spawn" title="method iroh_net_report::task::JoinSet::spawn"><code>JoinSet::spawn</code></a> on each element of the iterator.</p>
<h4 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h4>
<p>The main example from <a href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet"><code>JoinSet</code></a>’s documentation can also be written using <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#method.collect" title="method core::iter::traits::iterator::Iterator::collect"><code>collect</code></a>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task::JoinSet;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() {
<span class="kw">let </span><span class="kw-2">mut </span>set: JoinSet&lt;<span class="kw">_</span>&gt; = (<span class="number">0</span>..<span class="number">10</span>).map(|i| <span class="kw">async move </span>{ i }).collect();
<span class="kw">let </span><span class="kw-2">mut </span>seen = [<span class="bool-val">false</span>; <span class="number">10</span>];
<span class="kw">while let </span><span class="prelude-val">Some</span>(res) = set.join_next().<span class="kw">await </span>{
<span class="kw">let </span>idx = res.unwrap();
seen[idx] = <span class="bool-val">true</span>;
}
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
<span class="macro">assert!</span>(seen[i]);
}
}</code></pre></div>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_iter" class="method trait-impl"><a href="#method.from_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter" class="fn">from_iter</a>&lt;I&gt;(iter: I) -&gt; <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = F&gt;,</div></h4></section></summary><div class='docblock'>Creates a value from an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-JoinSet%3CT%3E" class="impl"><a href="#impl-Freeze-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section><section id="impl-RefUnwindSafe-for-JoinSet%3CT%3E" class="impl"><a href="#impl-RefUnwindSafe-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section><section id="impl-Send-for-JoinSet%3CT%3E" class="impl"><a href="#impl-Send-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-JoinSet%3CT%3E" class="impl"><a href="#impl-Sync-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Unpin-for-JoinSet%3CT%3E" class="impl"><a href="#impl-Unpin-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</h3></section><section id="impl-UnwindSafe-for-JoinSet%3CT%3E" class="impl"><a href="#impl-UnwindSafe-for-JoinSet%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.JoinSet.html" title="struct iroh_net_report::task::JoinSet">JoinSet</a>&lt;T&gt;</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/nightly/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/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/nightly/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/nightly/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/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/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/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsTaggedExplicit%3C'a,+E%3E-for-T" class="impl"><a href="#impl-AsTaggedExplicit%3C'a,+E%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T, E&gt; AsTaggedExplicit&lt;'a, E&gt; for T<div class="where">where
T: 'a,</div></h3></section></summary><div class="impl-items"><section id="method.explicit" class="method trait-impl"><a href="#method.explicit" class="anchor">§</a><h4 class="code-header">fn <a class="fn">explicit</a>(self, class: Class, tag: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; TaggedParser&lt;'a, Explicit, Self, E&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsTaggedImplicit%3C'a,+E%3E-for-T" class="impl"><a href="#impl-AsTaggedImplicit%3C'a,+E%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T, E&gt; AsTaggedImplicit&lt;'a, E&gt; for T<div class="where">where
T: 'a,</div></h3></section></summary><div class="impl-items"><section id="method.implicit" class="method trait-impl"><a href="#method.implicit" class="anchor">§</a><h4 class="code-header">fn <a class="fn">implicit</a>(
self,
class: Class,
constructed: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
tag: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
) -&gt; TaggedParser&lt;'a, Implicit, Self, E&gt;</h4></section></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/nightly/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/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/nightly/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/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/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/nightly/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/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/nightly/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/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#768">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Instrument-for-T" class="impl"><a href="#impl-Instrument-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; Instrument for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl"><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a class="fn">instrument</a>(self, span: Span) -&gt; Instrumented&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the provided [<code>Span</code>], returning an
<code>Instrumented</code> wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl"><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">in_current_span</a>(self) -&gt; Instrumented&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the <a href="super::Span::current()">current</a> <a href="crate::Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a>Read more</a></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/nightly/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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pointable-for-T" class="impl"><a href="#impl-Pointable-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; Pointable for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.ALIGN" class="associatedconstant trait-impl"><a href="#associatedconstant.ALIGN" class="anchor">§</a><h4 class="code-header">const <a class="constant">ALIGN</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = _</h4></section></summary><div class='docblock'>The alignment of pointer.</div></details><details class="toggle" open><summary><section id="associatedtype.Init" class="associatedtype trait-impl"><a href="#associatedtype.Init" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Init</a> = T</h4></section></summary><div class='docblock'>The type for initializers.</div></details><details class="toggle method-toggle" open><summary><section id="method.init" class="method trait-impl"><a href="#method.init" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">init</a>(init: &lt;T as Pointable&gt;::Init) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Initializes a with the given initializer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a href="#method.deref" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref</a>&lt;'a&gt;(ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a T</a></h4></section></summary><div class='docblock'>Dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl"><a href="#method.deref_mut" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref_mut</a>&lt;'a&gt;(ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut T</a></h4></section></summary><div class='docblock'>Mutably dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.drop-1" class="method trait-impl"><a href="#method.drop-1" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">drop</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Drops the object pointed to by the given pointer. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Same-for-T" class="impl"><a class="src rightside" href="https://docs.rs/typenum/1.17.0/src/typenum/type_operators.rs.html#34">Source</a><a href="#impl-Same-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://docs.rs/typenum/1.17.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a> for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/typenum/1.17.0/src/typenum/type_operators.rs.html#35">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.17.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="associatedtype">Output</a> = T</h4></section></summary><div class='docblock'>Should always be <code>Self</code></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/nightly/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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/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/nightly/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/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/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/nightly/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/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-VZip%3CV%3E-for-T" class="impl"><a href="#impl-VZip%3CV%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;V, T&gt; VZip&lt;V&gt; for T<div class="where">where
V: MultiLane&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><section id="method.vzip" class="method trait-impl"><a href="#method.vzip" class="anchor">§</a><h4 class="code-header">fn <a class="fn">vzip</a>(self) -&gt; V</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-T" class="impl"><a href="#impl-WithSubscriber-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; WithSubscriber for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl"><a href="#method.with_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_subscriber</a>&lt;S&gt;(self, subscriber: S) -&gt; WithDispatch&lt;Self&gt;<div class="where">where
S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;Dispatch&gt;,</div></h4></section></summary><div class='docblock'>Attaches the provided <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
[<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl"><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_current_subscriber</a>(self) -&gt; WithDispatch&lt;Self&gt;</h4></section></summary><div class='docblock'>Attaches the current <a href="crate::dispatcher#setting-the-default-subscriber">default</a> <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
[<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details></div></details><section id="impl-ErasedDestructor-for-T" class="impl"><a href="#impl-ErasedDestructor-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; ErasedDestructor for T<div class="where">where
T: 'static,</div></h3></section><section id="impl-MaybeSendSync-for-T" class="impl"><a href="#impl-MaybeSendSync-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; MaybeSendSync for T</h3></section></div></section></div></main></body></html>