Files
google-apis-rs/tracing/struct.Span.html
2021-04-02 00:20:57 +08:00

458 lines
81 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="API documentation for the Rust `Span` struct in crate `tracing`."><meta name="keywords" content="rust, rustlang, rust-lang, Span"><title>tracing::Span - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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">&#9776;</div><a href='../tracing/index.html'><div class='logo-container'><img src='https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png' alt='logo'></div></a><p class="location">Struct Span</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.child_of">child_of</a><a href="#method.current">current</a><a href="#method.enter">enter</a><a href="#method.entered">entered</a><a href="#method.field">field</a><a href="#method.follows_from">follows_from</a><a href="#method.has_field">has_field</a><a href="#method.id">id</a><a href="#method.in_scope">in_scope</a><a href="#method.is_disabled">is_disabled</a><a href="#method.is_none">is_none</a><a href="#method.metadata">metadata</a><a href="#method.new">new</a><a href="#method.new_disabled">new_disabled</a><a href="#method.new_root">new_root</a><a href="#method.none">none</a><a href="#method.record">record</a><a href="#method.record_all">record_all</a><a href="#method.with_subscriber">with_subscriber</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Drop">Drop</a><a href="#impl-Hash">Hash</a><a href="#impl-Into%3COption%3C%26%27a%20Id%3E%3E">Into&lt;Option&lt;&amp;&#39;a Id&gt;&gt;</a><a href="#impl-Into%3COption%3CId%3E%3E">Into&lt;Option&lt;Id&gt;&gt;</a><a href="#impl-PartialEq%3CSpan%3E">PartialEq&lt;Span&gt;</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&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="index.html">tracing</a></p><div id="sidebar-vars" data-name="Span" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></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><button type="button" class="help-button">?</button>
<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="in-band">Struct <a href="index.html">tracing</a>::<wbr><a class="struct" href="">Span</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../src/tracing/span.rs.html#361-371" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct Span { /* fields omitted */ }</pre></div><div class="docblock"><p>A handle representing a span, with the capability to enter the span if it
exists.</p>
<p>If the span was rejected by the current <code>Subscriber</code>'s filter, entering the
span will silently do nothing. Thus, the handle can be used in the same
manner regardless of whether or not the trace is currently being collected.</p>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#435-1251" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(meta: &amp;'static <a class="struct" href="../tracing/struct.Metadata.html" title="struct tracing::Metadata">Metadata</a>&lt;'static&gt;, values: &amp;<a class="struct" href="../tracing/field/struct.ValueSet.html" title="struct tracing::field::ValueSet">ValueSet</a>&lt;'_&gt;) -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#449-451" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new <code>Span</code> with the given <a href="../metadata">metadata</a> and set of
<a href="../field/struct.ValueSet.html">field values</a>.</p>
<p>The new span will be constructed by the currently-active <a href="../subscriber/trait.Subscriber.html"><code>Subscriber</code></a>,
with the current span as its parent (if one exists).</p>
<p>After the span is constructed, <a href="../field/struct.ValueSet.html">field values</a> and/or <a href="../struct.Span.html#method.follows_from"><code>follows_from</code></a>
annotations may be added to it.</p>
</div><h4 id="method.new_root" class="method"><code>pub fn <a href="#method.new_root" class="fnname">new_root</a>(meta: &amp;'static <a class="struct" href="../tracing/struct.Metadata.html" title="struct tracing::Metadata">Metadata</a>&lt;'static&gt;, values: &amp;<a class="struct" href="../tracing/field/struct.ValueSet.html" title="struct tracing::field::ValueSet">ValueSet</a>&lt;'_&gt;) -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#473-475" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new <code>Span</code> as the root of its own trace tree, with the
given <a href="../metadata">metadata</a> and set of <a href="../field/struct.ValueSet.html">field values</a>.</p>
<p>After the span is constructed, <a href="../field/struct.ValueSet.html">field values</a> and/or <a href="../struct.Span.html#method.follows_from"><code>follows_from</code></a>
annotations may be added to it.</p>
</div><h4 id="method.child_of" class="method"><code>pub fn <a href="#method.child_of" class="fnname">child_of</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;parent: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;meta: &amp;'static <a class="struct" href="../tracing/struct.Metadata.html" title="struct tracing::Metadata">Metadata</a>&lt;'static&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;values: &amp;<a class="struct" href="../tracing/field/struct.ValueSet.html" title="struct tracing::field::ValueSet">ValueSet</a>&lt;'_&gt;<br>) -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#497-506" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new <code>Span</code> as child of the given parent span, with the
given <a href="../metadata">metadata</a> and set of <a href="../field/struct.ValueSet.html">field values</a>.</p>
<p>After the span is constructed, <a href="../field/struct.ValueSet.html">field values</a> and/or <a href="../struct.Span.html#method.follows_from"><code>follows_from</code></a>
annotations may be added to it.</p>
</div><h4 id="method.new_disabled" class="method"><code>pub fn <a href="#method.new_disabled" class="fnname">new_disabled</a>(meta: &amp;'static <a class="struct" href="../tracing/struct.Metadata.html" title="struct tracing::Metadata">Metadata</a>&lt;'static&gt;) -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#532-537" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new disabled span with the given <code>Metadata</code>.</p>
<p>This should be used when a span is constructed from a known callsite,
but the subscriber indicates that it is disabled.</p>
<p>Entering, exiting, and recording values on this span will not notify the
<code>Subscriber</code> but <em>may</em> record log messages if the <code>log</code> feature flag is
enabled.</p>
</div><h4 id="method.none" class="method"><code>pub const fn <a href="#method.none" class="fnname">none</a>() -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#546-551" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new span that is <em>completely disabled</em>.</p>
<p>This can be used rather than <code>Option&lt;Span&gt;</code> to represent cases where a
span is not present.</p>
<p>Entering, exiting, and recording values on this span will do nothing.</p>
</div><h4 id="method.current" class="method"><code>pub fn <a href="#method.current" class="fnname">current</a>() -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#561-573" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a handle to the span <a href="../subscriber/trait.Subscriber.html#method.current">considered by the <code>Subscriber</code></a> to be the
current span.</p>
<p>If the subscriber indicates that it does not track the current span, or
that the thread from which this function is called is not currently
inside a span, the returned span will be disabled.</p>
</div><h4 id="method.enter" class="method"><code>pub fn <a href="#method.enter" class="fnname">enter</a>(&amp;self) -&gt; <a class="struct" href="../tracing/span/struct.Entered.html" title="struct tracing::span::Entered">Entered</a>&lt;'_&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#791-794" title="goto source code">[src]</a></h4><div class="docblock"><p>Enters this span, returning a guard that will exit the span when dropped.</p>
<p>If this span is enabled by the current subscriber, then this function will
call <a href="../subscriber/trait.Subscriber.html#method.enter"><code>Subscriber::enter</code></a> with the span's <a href="../struct.Id.html"><code>Id</code></a>, and dropping the guard
will call <a href="../subscriber/trait.Subscriber.html#method.exit"><code>Subscriber::exit</code></a>. If the span is disabled, this does
nothing.</p>
<h1 id="in-asynchronous-code" class="section-header"><a href="#in-asynchronous-code">In Asynchronous Code</a></h1>
<p><strong>Warning</strong>: in asynchronous code that uses <a href="https://rust-lang.github.io/async-book/01_getting_started/04_async_await_primer.html">async/await syntax</a>,
<code>Span::enter</code> should be used very carefully or avoided entirely. Holding
the drop guard returned by <code>Span::enter</code> across <code>.await</code> points will
result in incorrect traces.</p>
<p>For example,</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">my_async_function</span>() {
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;my_async_function&quot;</span>);
<span class="comment">// THIS WILL RESULT IN INCORRECT TRACES</span>
<span class="kw">let</span> <span class="ident">_enter</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">enter</span>();
<span class="ident">some_other_async_function</span>().<span class="kw">await</span>;
<span class="comment">// ...</span>
}</pre></div>
<p>The drop guard returned by <code>Span::enter</code> exits the span when it is
dropped. When an async function or async block yields at an <code>.await</code>
point, the current scope is <em>exited</em>, but values in that scope are
<strong>not</strong> dropped (because the async block will eventually resume
execution from that await point). This means that <em>another</em> task will
begin executing while <em>remaining</em> in the entered span. This results in
an incorrect trace.</p>
<p>Instead of using <code>Span::enter</code> in asynchronous code, prefer the
following:</p>
<ul>
<li>
<p>To enter a span for a synchronous section of code within an async
block or function, prefer <a href="#method.in_scope"><code>Span::in_scope</code></a>. Since <code>in_scope</code> takes a
synchronous closure and exits the span when the closure returns, the
span will always be exited before the next await point. For example:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">my_async_function</span>() {
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;my_async_function&quot;</span>);
<span class="kw">let</span> <span class="ident">some_value</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">in_scope</span>(<span class="op">|</span><span class="op">|</span> {
<span class="comment">// run some synchronous code inside the span...</span>
});
<span class="comment">// This is okay! The span has already been exited before we reach</span>
<span class="comment">// the await point.</span>
<span class="ident">some_other_async_function</span>(<span class="ident">some_value</span>).<span class="kw">await</span>;
<span class="comment">// ...</span>
}</pre></div>
</li>
<li>
<p>For instrumenting asynchronous code, <code>tracing</code> provides the
<a href="https://docs.rs/tracing/latest/tracing/trait.Instrument.html"><code>Future::instrument</code> combinator</a> for
attaching a span to a future (async function or block). This will
enter the span <em>every</em> time the future is polled, and exit it whenever
the future yields.</p>
<p><code>Instrument</code> can be used with an async block inside an async function:</p>
<div class='information'><div class='tooltip ignore'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">use</span> <span class="ident">tracing</span>::<span class="ident">Instrument</span>;
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">my_async_function</span>() {
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;my_async_function&quot;</span>);
<span class="kw">async</span> <span class="kw">move</span> {
<span class="comment">// This is correct! If we yield here, the span will be exited,</span>
<span class="comment">// and re-entered when we resume.</span>
<span class="ident">some_other_async_function</span>().<span class="kw">await</span>;
<span class="comment">//more asynchronous code inside the span...</span>
}
<span class="comment">// instrument the async block with the span...</span>
.<span class="ident">instrument</span>(<span class="ident">span</span>)
<span class="comment">// ...and await it.</span>
.<span class="kw">await</span>
}</pre></div>
<p>It can also be used to instrument calls to async functions at the
callsite:</p>
<div class='information'><div class='tooltip ignore'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">use</span> <span class="ident">tracing</span>::<span class="ident">Instrument</span>;
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">my_async_function</span>() {
<span class="kw">let</span> <span class="ident">some_value</span> <span class="op">=</span> <span class="ident">some_other_async_function</span>()
.<span class="ident">instrument</span>(<span class="macro">debug_span</span><span class="macro">!</span>(<span class="string">&quot;some_other_async_function&quot;</span>))
.<span class="kw">await</span>;
<span class="comment">// ...</span>
}</pre></div>
</li>
<li>
<p>The <a href="../../attr.instrument.html"><code>#[instrument]</code> attribute macro</a> can automatically generate
correct code when used on an async function:</p>
<div class='information'><div class='tooltip ignore'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="attribute">#[<span class="ident">tracing</span>::<span class="ident">instrument</span>(<span class="ident">level</span> <span class="op">=</span> <span class="string">&quot;info&quot;</span>)]</span>
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">my_async_function</span>() {
<span class="comment">// This is correct! If we yield here, the span will be exited,</span>
<span class="comment">// and re-entered when we resume.</span>
<span class="ident">some_other_async_function</span>().<span class="kw">await</span>;
<span class="comment">// ...</span>
}</pre></div>
</li>
</ul>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span> <span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">tracing</span>;
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">&quot;my_span&quot;</span>);
<span class="kw">let</span> <span class="ident">guard</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">enter</span>();
<span class="comment">// code here is within the span</span>
<span class="ident">drop</span>(<span class="ident">guard</span>);
<span class="comment">// code here is no longer within the span</span>
</pre></div>
<p>Guards need not be explicitly dropped:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span> <span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">tracing</span>;
<span class="kw">fn</span> <span class="ident">my_function</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="comment">// enter a span for the duration of this function.</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">trace_span</span><span class="macro">!</span>(<span class="string">&quot;my_function&quot;</span>);
<span class="kw">let</span> <span class="ident">_enter</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">enter</span>();
<span class="comment">// anything happening in functions we call is still inside the span...</span>
<span class="ident">my_other_function</span>();
<span class="comment">// returning from the function drops the guard, exiting the span.</span>
<span class="kw">return</span> <span class="string">&quot;Hello world&quot;</span>.<span class="ident">to_owned</span>();
}
<span class="kw">fn</span> <span class="ident">my_other_function</span>() {
<span class="comment">// ...</span>
}</pre></div>
<p>Sub-scopes may be created to limit the duration for which the span is
entered:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span> <span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">tracing</span>;
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;my_great_span&quot;</span>);
{
<span class="kw">let</span> <span class="ident">_enter</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">enter</span>();
<span class="comment">// this event occurs inside the span.</span>
<span class="macro">info</span><span class="macro">!</span>(<span class="string">&quot;i&#39;m in the span!&quot;</span>);
<span class="comment">// exiting the scope drops the guard, exiting the span.</span>
}
<span class="comment">// this event is not inside the span.</span>
<span class="macro">info</span><span class="macro">!</span>(<span class="string">&quot;i&#39;m outside the span!&quot;</span>)</pre></div>
</div><h4 id="method.entered" class="method"><code>pub fn <a href="#method.entered" class="fnname">entered</a>(self) -&gt; <a class="struct" href="../tracing/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</a></code><a class="srclink" href="../src/tracing/span.rs.html#905-911" title="goto source code">[src]</a></h4><div class="docblock"><p>Enters this span, consuming it and returning a <a href="../tracing/span/struct.EnteredSpan.html" title="EnteredSpan">guard</a>
that will exit the span when dropped.</p>
<p>If this span is enabled by the current subscriber, then this function will
call <a href="../subscriber/trait.Subscriber.html#method.enter"><code>Subscriber::enter</code></a> with the span's <a href="../struct.Id.html"><code>Id</code></a>, and dropping the guard
will call <a href="../subscriber/trait.Subscriber.html#method.exit"><code>Subscriber::exit</code></a>. If the span is disabled, this does
nothing.</p>
<p>This is similar to the <a href="../tracing/struct.Span.html#method.enter" title="Span::enter"><code>Span::enter</code></a> method, except that it moves the
span by value into the returned guard, rather than borrowing it.
Therefore, this method can be used to create and enter a span in a
single expression, without requiring a <code>let</code>-binding. For example:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">_span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;something_interesting&quot;</span>).<span class="ident">entered</span>();</pre></div>
<p>rather than:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;something_interesting&quot;</span>);
<span class="kw">let</span> <span class="ident">_e</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">enter</span>();</pre></div>
<p>Furthermore, <code>entered</code> may be used when the span must be stored in some
other struct or be passed to a function while remaining entered.</p>
<div class="information">
<div class="tooltip ignore" style=""><span class="tooltiptext">Note</span></div>
</div>
<div class="example-wrap" style="display:inline-block">
<pre class="ignore" style="white-space:normal;font:inherit;">
<p><strong>Note</strong>: The returned <a href="../tracing/span/struct.EnteredSpan.html" title="EnteredSpan"><code>EnteredSpan</code></a> guard does not
implement <code>Send</code>. Dropping the guard will exit <em>this</em> span,
and if the guard is sent to another thread and dropped there, that thread may
never have entered this span. Thus, <code>EnteredSpan</code>s should not be sent
between threads.</p>
<p></pre></div></p>
<p><strong>Warning</strong>: in asynchronous code that uses <a href="https://rust-lang.github.io/async-book/01_getting_started/04_async_await_primer.html">async/await syntax</a>,
<a href="../tracing/struct.Span.html#method.entered" title="Span::entered"><code>Span::entered</code></a> should be used very carefully or avoided entirely. Holding
the drop guard returned by <code>Span::entered</code> across <code>.await</code> points will
result in incorrect traces. See the documentation for the
<a href="../tracing/struct.Span.html#method.enter" title="Span::enter"><code>Span::enter</code></a> method for details.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<p>The returned guard can be <a href="../tracing/span/struct.EnteredSpan.html#method.exit" title="EnteredSpan::exit">explicitly exited</a>,
returning the un-entered span:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">&quot;doing_something&quot;</span>).<span class="ident">entered</span>();
<span class="comment">// code here is within the span</span>
<span class="comment">// explicitly exit the span, returning it</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">exit</span>();
<span class="comment">// code here is no longer within the span</span>
<span class="comment">// enter the span again</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">entered</span>();
<span class="comment">// now we are inside the span once again</span></pre></div>
<p>Guards need not be explicitly dropped:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">fn</span> <span class="ident">my_function</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="comment">// enter a span for the duration of this function.</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">trace_span</span><span class="macro">!</span>(<span class="string">&quot;my_function&quot;</span>).<span class="ident">entered</span>();
<span class="comment">// anything happening in functions we call is still inside the span...</span>
<span class="ident">my_other_function</span>();
<span class="comment">// returning from the function drops the guard, exiting the span.</span>
<span class="kw">return</span> <span class="string">&quot;Hello world&quot;</span>.<span class="ident">to_owned</span>();
}
<span class="kw">fn</span> <span class="ident">my_other_function</span>() {
<span class="comment">// ...</span>
}</pre></div>
<p>Since the <a href="../tracing/span/struct.EnteredSpan.html" title="EnteredSpan"><code>EnteredSpan</code></a> guard can dereference to the <a href="../tracing/struct.Span.html" title="Span"><code>Span</code></a> itself,
the span may still be accessed while entered. For example:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">tracing</span>::<span class="ident">field</span>;
<span class="comment">// create the span with an empty field, and enter it.</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;my_span&quot;</span>, <span class="ident">some_field</span> <span class="op">=</span> <span class="ident">field</span>::<span class="ident">Empty</span>).<span class="ident">entered</span>();
<span class="comment">// we can still record a value for the field while the span is entered.</span>
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">&quot;some_field&quot;</span>, <span class="kw-2">&amp;</span><span class="string">&quot;hello world!&quot;</span>);</pre></div>
</div><h4 id="method.in_scope" class="method"><code>pub fn <a href="#method.in_scope" class="fnname">in_scope</a>&lt;F:&nbsp;<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, T&gt;(&amp;self, f: F) -&gt; T</code><a class="srclink" href="../src/tracing/span.rs.html#980-983" title="goto source code">[src]</a></h4><div class="docblock"><p>Executes the given function in the context of this span.</p>
<p>If this span is enabled, then this function enters the span, invokes <code>f</code>
and then exits the span. If the span is disabled, <code>f</code> will still be
invoked, but in the context of the currently-executing span (if there is
one).</p>
<p>Returns the result of evaluating <code>f</code>.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">my_span</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">TRACE</span>, <span class="string">&quot;my_span&quot;</span>);
<span class="ident">my_span</span>.<span class="ident">in_scope</span>(<span class="op">|</span><span class="op">|</span> {
<span class="comment">// this event occurs within the span.</span>
<span class="macro">trace</span><span class="macro">!</span>(<span class="string">&quot;i&#39;m in the span!&quot;</span>);
});
<span class="comment">// this event occurs outside the span.</span>
<span class="macro">trace</span><span class="macro">!</span>(<span class="string">&quot;i&#39;m not in the span!&quot;</span>);</pre></div>
<p>Calling a function and returning the result:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">fn</span> <span class="ident">hello_world</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="string">&quot;Hello world!&quot;</span>.<span class="ident">to_owned</span>()
}
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;hello_world&quot;</span>);
<span class="comment">// the span will be entered for the duration of the call to</span>
<span class="comment">// `hello_world`.</span>
<span class="kw">let</span> <span class="ident">a_string</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">in_scope</span>(<span class="ident">hello_world</span>);</pre></div>
</div><h4 id="method.field" class="method"><code>pub fn <a href="#method.field" class="fnname">field</a>&lt;Q:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;self, field: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Q) -&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="struct" href="../tracing/field/struct.Field.html" title="struct tracing::field::Field">Field</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="../tracing/field/trait.AsField.html" title="trait tracing::field::AsField">AsField</a>,&nbsp;</span></code><a class="srclink" href="../src/tracing/span.rs.html#987-992" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a <a href="../field/struct.Field.html"><code>Field</code></a> for the field with the
given <code>name</code>, if one exists,</p>
</div><h4 id="method.has_field" class="method"><code>pub fn <a href="#method.has_field" class="fnname">has_field</a>&lt;Q:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;self, field: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Q) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="../tracing/field/trait.AsField.html" title="trait tracing::field::AsField">AsField</a>,&nbsp;</span></code><a class="srclink" href="../src/tracing/span.rs.html#997-1002" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns true if this <code>Span</code> has a field for the given
<a href="../field/struct.Field.html"><code>Field</code></a> or field name.</p>
</div><h4 id="method.record" class="method"><code>pub fn <a href="#method.record" class="fnname">record</a>&lt;Q:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, V&gt;(&amp;self, field: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Q, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>V) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="../tracing/field/trait.AsField.html" title="trait tracing::field::AsField">AsField</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../tracing/trait.Value.html" title="trait tracing::Value">Value</a>,&nbsp;</span></code><a class="srclink" href="../src/tracing/span.rs.html#1076-1092" title="goto source code">[src]</a></h4><div class="docblock"><p>Records that the field described by <code>field</code> has the value <code>value</code>.</p>
<p>This may be used with <a href="../field/struct.Empty.html"><code>field::Empty</code></a> to declare fields whose values
are not known when the span is created, and record them later:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">tracing</span>::{<span class="ident">trace_span</span>, <span class="ident">field</span>};
<span class="comment">// Create a span with two fields: `greeting`, with the value &quot;hello world&quot;, and</span>
<span class="comment">// `parting`, without a value.</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">trace_span</span><span class="macro">!</span>(<span class="string">&quot;my_span&quot;</span>, <span class="ident">greeting</span> <span class="op">=</span> <span class="string">&quot;hello world&quot;</span>, <span class="ident">parting</span> <span class="op">=</span> <span class="ident">field</span>::<span class="ident">Empty</span>);
<span class="comment">// ...</span>
<span class="comment">// Now, record a value for parting as well.</span>
<span class="comment">// (note that the field name is passed as a string slice)</span>
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">&quot;parting&quot;</span>, <span class="kw-2">&amp;</span><span class="string">&quot;goodbye world!&quot;</span>);</pre></div>
<p>However, it may also be used to record a <em>new</em> value for a field whose
value was already recorded:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">tracing</span>::<span class="ident">info_span</span>;
<span class="comment">// Initially, let&#39;s assume that our attempt to do something is going okay...</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">info_span</span><span class="macro">!</span>(<span class="string">&quot;doing_something&quot;</span>, <span class="ident">is_okay</span> <span class="op">=</span> <span class="bool-val">true</span>);
<span class="kw">let</span> <span class="ident">_e</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">enter</span>();
<span class="kw">match</span> <span class="ident">do_something</span>() {
<span class="prelude-val">Ok</span>(<span class="ident">something</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="comment">// ...</span>
}
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="comment">// Things are no longer okay!</span>
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">&quot;is_okay&quot;</span>, <span class="kw-2">&amp;</span><span class="bool-val">false</span>);
}
}</pre></div>
<div class="information">
<div class="tooltip ignore" style=""><span class="tooltiptext">Note</span></div>
</div>
<div class="example-wrap" style="display:inline-block">
<pre class="ignore" style="white-space:normal;font:inherit;">
<strong>Note</strong>: The fields associated with a span are part of its
<a href="../struct.Metadata.html"><code>Metadata</code></a>.
The <a href="../struct.Metadata.html"><code>Metadata</code></a>. describing a particular
span is constructed statically when the span is created and cannot be extended later to
add new fields. Therefore, you cannot record a value for a field that was not specified
when the span was created:</pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">tracing</span>::{<span class="ident">trace_span</span>, <span class="ident">field</span>};
<span class="comment">// Create a span with two fields: `greeting`, with the value &quot;hello world&quot;, and</span>
<span class="comment">// `parting`, without a value.</span>
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">trace_span</span><span class="macro">!</span>(<span class="string">&quot;my_span&quot;</span>, <span class="ident">greeting</span> <span class="op">=</span> <span class="string">&quot;hello world&quot;</span>, <span class="ident">parting</span> <span class="op">=</span> <span class="ident">field</span>::<span class="ident">Empty</span>);
<span class="comment">// ...</span>
<span class="comment">// Now, you try to record a value for a new field, `new_field`, which was not</span>
<span class="comment">// declared as `Empty` or populated when you created `span`.</span>
<span class="comment">// You won&#39;t get any error, but the assignment will have no effect!</span>
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">&quot;new_field&quot;</span>, <span class="kw-2">&amp;</span><span class="string">&quot;interesting_value_you_really_need&quot;</span>);
<span class="comment">// Instead, all fields that may be recorded after span creation should be declared up front,</span>
<span class="comment">// using field::Empty when a value is not known, as we did for `parting`.</span>
<span class="comment">// This `record` call will indeed replace field::Empty with &quot;you will be remembered&quot;.</span>
<span class="ident">span</span>.<span class="ident">record</span>(<span class="string">&quot;parting&quot;</span>, <span class="kw-2">&amp;</span><span class="string">&quot;you will be remembered&quot;</span>);</pre></div>
</div><h4 id="method.record_all" class="method"><code>pub fn <a href="#method.record_all" class="fnname">record_all</a>(&amp;self, values: &amp;<a class="struct" href="../tracing/field/struct.ValueSet.html" title="struct tracing::field::ValueSet">ValueSet</a>&lt;'_&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self</code><a class="srclink" href="../src/tracing/span.rs.html#1095-1113" title="goto source code">[src]</a></h4><div class="docblock"><p>Records all the fields in the provided <code>ValueSet</code>.</p>
</div><h4 id="method.is_disabled" class="method"><code>pub fn <a href="#method.is_disabled" class="fnname">is_disabled</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../src/tracing/span.rs.html#1122-1124" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if this span was disabled by the subscriber and does not
exist.</p>
<p>See also <a href="#method.is_none"><code>is_none</code></a>.</p>
</div><h4 id="method.is_none" class="method"><code>pub fn <a href="#method.is_none" class="fnname">is_none</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../src/tracing/span.rs.html#1137-1139" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if this span was constructed by <a href="#method.none"><code>Span::none</code></a> and is
empty.</p>
<p>If <code>is_none</code> returns <code>true</code> for a given span, then <a href="#method.is_disabled"><code>is_disabled</code></a> will
also return <code>true</code>. However, when a span is disabled by the subscriber
rather than constructed by <code>Span::none</code>, this method will return
<code>false</code>, while <code>is_disabled</code> will return <code>true</code>.</p>
</div><h4 id="method.follows_from" class="method"><code>pub fn <a href="#method.follows_from" class="fnname">follows_from</a>(&amp;self, from: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self</code><a class="srclink" href="../src/tracing/span.rs.html#1188-1195" title="goto source code">[src]</a></h4><div class="docblock"><p>Indicates that the span with the given ID has an indirect causal
relationship with this span.</p>
<p>This relationship differs somewhat from the parent-child relationship: a
span may have any number of prior spans, rather than a single one; and
spans are not considered to be executing <em>inside</em> of the spans they
follow from. This means that a span may close even if subsequent spans
that follow from it are still open, and time spent inside of a
subsequent span should not be included in the time its precedents were
executing. This is used to model causal relationships such as when a
single future spawns several related background tasks, et cetera.</p>
<p>If this span is disabled, or the resulting follows-from relationship
would be invalid, this function will do nothing.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<p>Setting a <code>follows_from</code> relationship with a <code>Span</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span1</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">&quot;span_1&quot;</span>);
<span class="kw">let</span> <span class="ident">span2</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">DEBUG</span>, <span class="string">&quot;span_2&quot;</span>);
<span class="ident">span2</span>.<span class="ident">follows_from</span>(<span class="ident">span1</span>);</pre></div>
<p>Setting a <code>follows_from</code> relationship with the current span:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">&quot;hello!&quot;</span>);
<span class="ident">span</span>.<span class="ident">follows_from</span>(<span class="ident">Span</span>::<span class="ident">current</span>());</pre></div>
<p>Setting a <code>follows_from</code> relationship with a <code>Span</code> reference:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">&quot;hello!&quot;</span>);
<span class="kw">let</span> <span class="ident">curr</span> <span class="op">=</span> <span class="ident">Span</span>::<span class="ident">current</span>();
<span class="ident">span</span>.<span class="ident">follows_from</span>(<span class="kw-2">&amp;</span><span class="ident">curr</span>);</pre></div>
<p>Setting a <code>follows_from</code> relationship with an <code>Id</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">&quot;hello!&quot;</span>);
<span class="kw">let</span> <span class="ident">id</span> <span class="op">=</span> <span class="ident">span</span>.<span class="ident">id</span>();
<span class="ident">span</span>.<span class="ident">follows_from</span>(<span class="ident">id</span>);</pre></div>
</div><h4 id="method.id" class="method"><code>pub fn <a href="#method.id" class="fnname">id</a>(&amp;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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#1198-1200" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns this span's <code>Id</code>, if it is enabled.</p>
</div><h4 id="method.metadata" class="method"><code>pub fn <a href="#method.metadata" class="fnname">metadata</a>(&amp;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;&amp;'static <a class="struct" href="../tracing/struct.Metadata.html" title="struct tracing::Metadata">Metadata</a>&lt;'static&gt;&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#1203-1205" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns this span's <code>Metadata</code>, if it is enabled.</p>
</div><h4 id="method.with_subscriber" class="method"><code>pub fn <a href="#method.with_subscriber" class="fnname">with_subscriber</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>&amp;<a class="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>, &amp;<a class="struct" href="../tracing/struct.Dispatch.html" title="struct tracing::Dispatch">Dispatch</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>) -&gt; T<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#1246-1250" title="goto source code">[src]</a></h4><div class="docblock"><p>Invokes a function with a reference to this span's ID and subscriber.</p>
<p>if this span is enabled, the provided function is called, and the result is returned.
If the span is disabled, the function is not called, and this method returns <code>None</code>
instead.</p>
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#360" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../src/tracing/span.rs.html#360" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1270-1301" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../src/tracing/span.rs.html#1271-1300" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>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></p>
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl <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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1321-1341" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&amp;mut self)</code><a class="srclink" href="../src/tracing/span.rs.html#1322-1340" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>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></p>
</div></div><h3 id="impl-Hash" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Hash" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1264-1268" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.hash" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash" class="fnname">hash</a>&lt;H:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>&gt;(&amp;self, hasher: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>H)</code><a class="srclink" href="../src/tracing/span.rs.html#1265-1267" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
</div><h4 id="method.hash_slice" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice" class="fnname">hash_slice</a>&lt;H&gt;(data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#184-186" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
</div></div><h3 id="impl-Into%3COption%3C%26%27a%20Id%3E%3E" class="impl"><code class="in-band">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</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;&amp;'a <a class="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;&gt; for &amp;'a <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Into%3COption%3C%26%27a%20Id%3E%3E" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1303-1307" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(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;&amp;'a <a class="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#1304-1306" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-Into%3COption%3CId%3E%3E" class="impl"><code class="in-band">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;&gt; for &amp;'a <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Into%3COption%3CId%3E%3E" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1309-1313" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#1310-1312" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-Into%3COption%3CId%3E%3E-1" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;&gt; for <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Into%3COption%3CId%3E%3E-1" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1315-1319" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into-2" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(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="struct" href="../tracing/span/struct.Id.html" title="struct tracing::span::Id">Id</a>&gt;</code><a class="srclink" href="../src/tracing/span.rs.html#1316-1318" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-PartialEq%3CSpan%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a>&gt; for <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-PartialEq%3CSpan%3E" class="anchor"></a><a class="srclink" href="../src/tracing/span.rs.html#1253-1262" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.eq" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../src/tracing/span.rs.html#1254-1261" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id="method.ne" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#213" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
</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 !<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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a><a class="srclink" href="../src/tracing/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../src/tracing/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Sync" class="anchor"></a><a class="srclink" href="../src/tracing/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-Unpin" class="anchor"></a><a class="srclink" href="../src/tracing/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl !<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="../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a href="#impl-UnwindSafe" class="anchor"></a><a class="srclink" href="../src/tracing/lib.rs.html#1" title="goto source code">[src]</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&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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">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></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" 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&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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</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#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" 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&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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</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#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" 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&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</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#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-Instrument" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="../tracing/trait.Instrument.html" title="trait tracing::Instrument">Instrument</a> for T</code><a href="#impl-Instrument" class="anchor"></a><a class="srclink" href="../src/tracing/instrument.rs.html#155" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.instrument" class="method hidden"><code>fn <a href="../tracing/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="../tracing/struct.Span.html" title="struct tracing::Span">Span</a>) -&gt; <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;T&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;T&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = T::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>;</span></code></span></div></span></span></code><a class="srclink" href="../src/tracing/instrument.rs.html#38-40" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Instruments this type with the provided <code>Span</code>, returning an
<code>Instrumented</code> wrapper. <a href="../tracing/trait.Instrument.html#method.instrument">Read more</a></p>
</div><h4 id="method.in_current_span" class="method hidden"><code>fn <a href="../tracing/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -&gt; <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;T&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;T&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = T::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>;</span></code></span></div></span></span></code><a class="srclink" href="../src/tracing/instrument.rs.html#74-76" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Instruments this type with the <a href="../struct.Span.html#method.current">current</a> <code>Span</code>, returning an
<code>Instrumented</code> wrapper. <a href="../tracing/trait.Instrument.html#method.in_current_span">Read more</a></p>
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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;,&nbsp;</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#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into-3" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</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>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/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>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>&nbsp;<a href="https://github.com/tokio-rs/tracing/issues/41263">#41263</a>)</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="https://doc.rust-lang.org/nightly/alloc/borrow/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&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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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;,&nbsp;</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#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::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>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" 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&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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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;,&nbsp;</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#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::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>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" 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><div id="rustdoc-vars" data-root-path="../" data-current-crate="tracing"></div>
<script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>