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

335 lines
58 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 `EnteredSpan` struct in crate `tracing`."><meta name="keywords" content="rust, rustlang, rust-lang, EnteredSpan"><title>tracing::span::EnteredSpan - 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 EnteredSpan</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.exit">exit</a></div><a class="sidebar-title" href="#deref-methods-Span">Methods from Deref&lt;Target=Span&gt;</a><div class="sidebar-links"><a href="#method.enter">enter</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.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-Debug">Debug</a><a href="#impl-Deref">Deref</a><a href="#impl-Drop">Drop</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-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>::<wbr><a href="index.html">span</a></p><div id="sidebar-vars" data-name="EnteredSpan" 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 href="index.html">span</a>::<wbr><a class="struct" href="">EnteredSpan</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#414-424" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct"><span class="docblock attributes top-attr">#[must_use = "once a span has been entered, it should be exited"]</span>pub struct EnteredSpan { /* fields omitted */ }</pre></div><div class="docblock"><p>An owned version of <a href="../../tracing/span/struct.Entered.html" title="Entered"><code>Entered</code></a>, a guard representing a span which has been
entered and is currently executing.</p>
<p>When the guard is dropped, the span will be exited.</p>
<p>This is returned by the <a href="../../tracing/struct.Span.html#method.entered"><code>Span::entered</code></a> function.</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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tracing/span.rs.html#1405-1414" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.exit" class="method"><code>pub fn <a href="#method.exit" class="fnname">exit</a>(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#1408-1413" title="goto source code">[src]</a></h4><div class="docblock"><p>Exits this span, returning the underlying <a href="../../tracing/struct.Span.html" title="Span"><code>Span</code></a>.</p>
</div></div><h2 id="deref-methods-Span" class="small-section-header">Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = <a class="struct" href="../../tracing/struct.Span.html" title="struct tracing::Span">Span</a>&gt;<a href="#deref-methods-Span" class="anchor"></a></h2><div class="impl-items"><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.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-1" class="section-header"><a href="#examples-1">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-2" class="section-header"><a href="#examples-2">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-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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tracing/span.rs.html#412" 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#412" 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-Deref" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../../tracing/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</a></code><a href="#impl-Deref" class="anchor"></a><a class="srclink" href="../../src/tracing/span.rs.html#1416-1423" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Target" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" class="type">Target</a> = <a class="struct" href="../../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code></h4><div class='docblock'><p>The resulting type after dereferencing.</p>
</div><h4 id="method.deref" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref" class="fnname">deref</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../tracing/struct.Span.html" title="struct tracing::Span">Span</a></code><a class="srclink" href="../../src/tracing/span.rs.html#1420-1422" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Dereferences the value.</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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</a></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../../src/tracing/span.rs.html#1432-1437" 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#1434-1436" 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></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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</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/span/struct.EnteredSpan.html" title="struct tracing::span::EnteredSpan">EnteredSpan</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" 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-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>