mpvrc/tracing_subscriber/registry/trait.LookupSpan.html

39 lines
No EOL
17 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="Provides access to stored span data."><title>LookupSpan in tracing_subscriber::registry - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="tracing_subscriber" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../tracing_subscriber/index.html"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../tracing_subscriber/index.html"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt="logo"></a><h2><a href="../../tracing_subscriber/index.html">tracing_<wbr>subscriber</a><span class="version">0.3.19</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Lookup<wbr>Span</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Data" title="Data">Data</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.span_data" title="span_data">span_data</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.register_filter" title="register_filter">register_filter</a></li><li><a href="#method.span" title="span">span</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In tracing_<wbr>subscriber::<wbr>registry</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">tracing_subscriber</a>::<wbr><a href="index.html">registry</a></span><h1>Trait <span class="trait">LookupSpan</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/tracing_subscriber/registry/mod.rs.html#92-154">Source</a> </span></div><pre class="rust item-decl"><code>pub trait LookupSpan&lt;'a&gt; {
type <a href="#associatedtype.Data" class="associatedtype">Data</a>: <a class="trait" href="trait.SpanData.html" title="trait tracing_subscriber::registry::SpanData">SpanData</a>&lt;'a&gt;;
// Required method
fn <a href="#tymethod.span_data" class="fn">span_data</a>(&amp;'a self, id: &amp;<a class="struct" href="../../tracing_core/span/struct.Id.html" title="struct tracing_core::span::Id">Id</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.LookupSpan.html#associatedtype.Data" title="type tracing_subscriber::registry::LookupSpan::Data">Data</a>&gt;;
// Provided methods
fn <a href="#method.span" class="fn">span</a>(&amp;'a self, id: &amp;<a class="struct" href="../../tracing_core/span/struct.Id.html" title="struct tracing_core::span::Id">Id</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.SpanRef.html" title="struct tracing_subscriber::registry::SpanRef">SpanRef</a>&lt;'a, Self&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.register_filter" class="fn">register_filter</a>(&amp;mut self) -&gt; <a class="struct" href="../filter/struct.FilterId.html" title="struct tracing_subscriber::filter::FilterId">FilterId</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides access to stored span data.</p>
<p>Subscribers which store span data and associate it with span IDs should
implement this trait; if they do, any <a href="../layer/trait.Layer.html" title="trait tracing_subscriber::layer::Layer"><code>Layer</code></a>s wrapping them can look up
metadata via the <a href="../layer/struct.Context.html" title="struct tracing_subscriber::layer::Context"><code>Context</code></a> types <a href="../layer/struct.Context.html#method.span" title="method tracing_subscriber::layer::Context::span"><code>span()</code></a> method.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Data" class="method"><a class="src rightside" href="../../src/tracing_subscriber/registry/mod.rs.html#94">Source</a><h4 class="code-header">type <a href="#associatedtype.Data" class="associatedtype">Data</a>: <a class="trait" href="trait.SpanData.html" title="trait tracing_subscriber::registry::SpanData">SpanData</a>&lt;'a&gt;</h4></section></summary><div class="docblock"><p>The type of span data stored in this registry.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.span_data" class="method"><a class="src rightside" href="../../src/tracing_subscriber/registry/mod.rs.html#106">Source</a><h4 class="code-header">fn <a href="#tymethod.span_data" class="fn">span_data</a>(&amp;'a self, id: &amp;<a class="struct" href="../../tracing_core/span/struct.Id.html" title="struct tracing_core::span::Id">Id</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.LookupSpan.html#associatedtype.Data" title="type tracing_subscriber::registry::LookupSpan::Data">Data</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the <a href="trait.SpanData.html" title="trait tracing_subscriber::registry::SpanData"><code>SpanData</code></a> for a given <code>Id</code>, if it exists.</p>
<pre class="ignore" style="white-space:normal;font:inherit;">
<strong>Note</strong>: users of the <code>LookupSpan</code> trait should
typically call the <a href="#method.span"><code>span</code></a> method rather
than this method. The <code>span</code> method is implemented by
<em>calling</em> <code>span_data</code>, but returns a reference which is
capable of performing more sophisiticated queries.
</pre>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.span" class="method"><a class="src rightside" href="../../src/tracing_subscriber/registry/mod.rs.html#118-129">Source</a><h4 class="code-header">fn <a href="#method.span" class="fn">span</a>(&amp;'a self, id: &amp;<a class="struct" href="../../tracing_core/span/struct.Id.html" title="struct tracing_core::span::Id">Id</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.SpanRef.html" title="struct tracing_subscriber::registry::SpanRef">SpanRef</a>&lt;'a, Self&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Returns a <a href="struct.SpanRef.html" title="struct tracing_subscriber::registry::SpanRef"><code>SpanRef</code></a> for the span with the given <code>Id</code>, if it exists.</p>
<p>A <code>SpanRef</code> is similar to <a href="trait.SpanData.html" title="trait tracing_subscriber::registry::SpanData"><code>SpanData</code></a>, but it allows performing
additional lookups against the registryr that stores the wrapped data.</p>
<p>In general, <em>users</em> of the <code>LookupSpan</code> trait should use this method
rather than the <a href="trait.LookupSpan.html#tymethod.span_data" title="method tracing_subscriber::registry::LookupSpan::span_data"><code>span_data</code></a> method; while <em>implementors</em> of this trait
should only implement <code>span_data</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.register_filter" class="method"><a class="src rightside" href="../../src/tracing_subscriber/registry/mod.rs.html#148-153">Source</a><h4 class="code-header">fn <a href="#method.register_filter" class="fn">register_filter</a>(&amp;mut self) -&gt; <a class="struct" href="../filter/struct.FilterId.html" title="struct tracing_subscriber::filter::FilterId">FilterId</a></h4></section></summary><div class="docblock"><p>Registers a <a href="../layer/trait.Filter.html" title="trait tracing_subscriber::layer::Filter"><code>Filter</code></a> for <a href="../layer/trait.Layer.html#per-layer-filtering" title="trait tracing_subscriber::layer::Layer">per-layer filtering</a> with this
<a href="../../tracing_core/subscriber/trait.Subscriber.html" title="trait tracing_core::subscriber::Subscriber"><code>Subscriber</code></a>.</p>
<p>The <a href="../layer/trait.Filter.html" title="trait tracing_subscriber::layer::Filter"><code>Filter</code></a> can then use the returned <a href="../filter/struct.FilterId.html" title="struct tracing_subscriber::filter::FilterId"><code>FilterId</code></a> to
<a href="trait.SpanData.html#method.is_enabled_for" title="method tracing_subscriber::registry::SpanData::is_enabled_for">check if it previously enabled a span</a>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>If this <code>Subscriber</code> does not support <a href="../layer/trait.Layer.html#per-layer-filtering" title="trait tracing_subscriber::layer::Layer">per-layer filtering</a>.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-LookupSpan%3C'a%3E-for-Registry" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/registry/sharded.rs.html#369-382">Source</a><a href="#impl-LookupSpan%3C'a%3E-for-Registry" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt; for <a class="struct" href="struct.Registry.html" title="struct tracing_subscriber::registry::Registry">Registry</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Data-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/tracing_subscriber/registry/sharded.rs.html#370">Source</a><a href="#associatedtype.Data-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Data" class="associatedtype">Data</a> = <a class="struct" href="struct.Data.html" title="struct tracing_subscriber::registry::Data">Data</a>&lt;'a&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-LookupSpan%3C'a%3E-for-Layered%3CL,+S%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/layer/layered.rs.html#385-399">Source</a><a href="#impl-LookupSpan%3C'a%3E-for-Layered%3CL,+S%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, L, S&gt; <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt; for <a class="struct" href="../layer/struct.Layered.html" title="struct tracing_subscriber::layer::Layered">Layered</a>&lt;L, S&gt;<div class="where">where
S: <a class="trait" href="../../tracing_core/subscriber/trait.Subscriber.html" title="trait tracing_core::subscriber::Subscriber">Subscriber</a> + <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Data-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/tracing_subscriber/layer/layered.rs.html#389">Source</a><a href="#associatedtype.Data-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Data" class="associatedtype">Data</a> = &lt;S as <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.LookupSpan.html#associatedtype.Data" title="type tracing_subscriber::registry::LookupSpan::Data">Data</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-LookupSpan%3C'a%3E-for-Subscriber%3CN,+E,+F,+W%3E" class="impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/mod.rs.html#451-460">Source</a><a href="#impl-LookupSpan%3C'a%3E-for-Subscriber%3CN,+E,+F,+W%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, N, E, F, W&gt; <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt; for <a class="struct" href="../fmt/struct.Subscriber.html" title="struct tracing_subscriber::fmt::Subscriber">Subscriber</a>&lt;N, E, F, W&gt;<div class="where">where
<a class="struct" href="../layer/struct.Layered.html" title="struct tracing_subscriber::layer::Layered">Layered</a>&lt;F, <a class="type" href="../fmt/type.Formatter.html" title="type tracing_subscriber::fmt::Formatter">Formatter</a>&lt;N, E, W&gt;&gt;: <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Data-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/tracing_subscriber/fmt/mod.rs.html#455">Source</a><a href="#associatedtype.Data-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Data" class="associatedtype">Data</a> = &lt;<a class="struct" href="../layer/struct.Layered.html" title="struct tracing_subscriber::layer::Layered">Layered</a>&lt;F, <a class="struct" href="../layer/struct.Layered.html" title="struct tracing_subscriber::layer::Layered">Layered</a>&lt;<a class="struct" href="../fmt/struct.Layer.html" title="struct tracing_subscriber::fmt::Layer">Layer</a>&lt;<a class="struct" href="struct.Registry.html" title="struct tracing_subscriber::registry::Registry">Registry</a>, N, E, W&gt;, <a class="struct" href="struct.Registry.html" title="struct tracing_subscriber::registry::Registry">Registry</a>&gt;&gt; as <a class="trait" href="trait.LookupSpan.html" title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a>&lt;'a&gt;&gt;::<a class="associatedtype" href="trait.LookupSpan.html#associatedtype.Data" title="type tracing_subscriber::registry::LookupSpan::Data">Data</a></h4></section></div></details></div><script src="../../trait.impl/tracing_subscriber/registry/trait.LookupSpan.js" async></script></section></div></main></body></html>