edlang/tracing_subscriber/registry/trait.LookupSpan.html
2024-05-05 09:43:20 +00:00

40 lines
18 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.write(`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2">`)</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-e935ef01ae1c1829.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.78.0 (9b00956e5 2024-04-29)" data-channel="1.78.0" data-search-js="search-42d8da7a6b9792c2.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-12cf3b4f4f9dc36d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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_subscriber</a><span class="version">0.3.18</span></h2></div><h2 class="location"><a href="#">LookupSpan</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Data">Data</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.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">register_filter</a></li><li><a href="#method.span">span</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In tracing_subscriber::registry</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../tracing_subscriber/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">tracing_subscriber</a>::<wbr><a href="index.html">registry</a>::<wbr><a class="trait" href="#">LookupSpan</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/tracing_subscriber/registry/mod.rs.html#92-154">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></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.78.0/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.78.0/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;'_, Self&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.78.0/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.78.0/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.78.0/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;'_, Self&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.78.0/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 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 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 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>