<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="Represents information about the current context provided to `Layer`s by the wrapped `Subscriber`."><title>Context in tracing_subscriber::layer - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><linkrel="stylesheet"href="../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../static.files/rustdoc-dd39b87e5fcfba68.css"><metaname="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.80.0 (051478957 2024-07-21)"data-channel="1.80.0"data-search-js="search-d52510db62a78183.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../../static.files/noscript-df360f571f6edeae.css"></noscript><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button><aclass="logo-container"href="../../tracing_subscriber/index.html"><imgsrc="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png"alt=""></a></nav><navclass="sidebar"><divclass="sidebar-crate"><aclass="logo-container"href="../../tracing_subscriber/index.html"><imgsrc="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png"alt="logo"></a><h2><ahref="../../tracing_subscriber/index.html">tracing_subscriber</a><spanclass="version">0.3.18</span></h2></div><h2class="location"><ahref="#">Context</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.current_span">current_span</a></li><li><ahref="#method.enabled">enabled</a></li><li><ahref="#method.event">event</a></li><li><ahref="#method.event_scope">event_scope</a></li><li><ahref="#method.event_span">event_span</a></li><li><ahref="#method.exists">exists</a></li><li><ahref="#method.lookup_current">lookup_current</a></li><li><ahref="#method.metadata">metadata</a></li><li><ahref="#method.span">span</a></li><li><ahref="#method.span_scope">span_scope</a></li></ul><h3><ahref="#trait-implementations">Trait Implementations</a></h3><ulclass="block trait-implementation"><li><ahref="#impl-Clone-for-Context%3C'a,+S%3E">Clone</a></li><li><ahref="#impl-Debug-for-Context%3C'a,+S%3E">Debug</a></li></ul><h3><ahref="#synthetic-implementations">Auto Trait Implementations</a></h3><ulclass="block synthetic-implementation"><li><ahref="#impl-Freeze-for-Context%3C'a,+S%3E">Freeze</a></li><li><ahref="#impl-RefUnwindSafe-for-Context%3C'a,+S%3E">RefUnwindSafe</a></li><li><ahref="#impl-Send-for-Context%3C'a,+S%3E">Send</a></li><li><ahref="#impl-Sync-for-Context%3C'a,+S%3E">Sync</a></li><li><ahref="#impl-Unpin-for-Context%3C'a,+S%3E">Unpin</a></li><li><ahref="#impl-UnwindSafe-for-Context%3C'a,+S%3E">UnwindSafe</a></li></ul><h3><ahref="#blanket-implementations">Blanket Implementations</a></h3><ulclass="blockblanket-imple
<p>To access <ahref="../registry/struct.SpanRef.html"title="struct tracing_subscriber::registry::SpanRef">stored data</a> keyed by a span ID, implementors of the <code>Layer</code>
trait should ensure that the <code>Subscriber</code> type parameter is <em>also</em> bound by the
S: <aclass="trait"href="../../tracing_core/subscriber/trait.Subscriber.html"title="trait tracing_core::subscriber::Subscriber">Subscriber</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.current_span"class="method"><aclass="src rightside"href="../../src/tracing_subscriber/layer/context.rs.html#66-72">source</a><h4class="code-header">pub fn <ahref="#method.current_span"class="fn">current_span</a>(&self) -><aclass="struct"href="../../tracing_core/span/struct.Current.html"title="struct tracing_core::span::Current">Current</a></h4></section></summary><divclass="docblock"><p>Returns the wrapped subscriber’s view of the current span.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.enabled"class="method"><aclass="src rightside"href="../../src/tracing_subscriber/layer/context.rs.html#76-84">source</a><h4class="code-header">pub fn <ahref="#method.enabled"class="fn">enabled</a>(&self, metadata: &<aclass="struct"href="../../tracing_core/metadata/struct.Metadata.html"title="struct tracing_core::metadata::Metadata">Metadata</a><'_>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether the wrapped subscriber would enable the current span.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.event"class="method"><aclass="src rightside"href="../../src/tracing_subscriber/layer/context.rs.html#106-110">source</a><h4class="code-header">pub fn <ahref="#method.event"class="fn">event</a>(&self, event: &<aclass="struct"href="../../tracing_core/event/struct.Event.html"title="struct tracing_core::event::Event">Event</a><'_>)</h4></section></summary><divclass="docblock"><p>Records the provided <code>event</code> with the wrapped subscriber.</p>
<li>The subscriber is free to expect that the event’s callsite has been
<ahref="../../tracing_core/subscriber/trait.Subscriber.html#method.register_callsite"title="method tracing_core::subscriber::Subscriber::register_callsite">registered</a>, and may panic or fail to observe the event if this is
not the case. The <code>tracing</code> crate’s macros ensure that all events are
registered, but if the event is constructed through other means, the
user is responsible for ensuring that <ahref="../../tracing_core/subscriber/trait.Subscriber.html#method.register_callsite"title="method tracing_core::subscriber::Subscriber::register_callsite"><code>register_callsite</code></a>
has been called prior to calling this method.</li>
<li>This does <em>not</em> call <ahref="../../tracing_core/subscriber/trait.Subscriber.html#tymethod.enabled"title="method tracing_core::subscriber::Subscriber::enabled"><code>enabled</code></a> on the inner subscriber. If the
caller wishes to apply the wrapped subscriber’s filter before choosing
whether to record the event, it may first call <ahref="struct.Context.html#method.enabled"title="method tracing_subscriber::layer::Context::enabled"><code>Context::enabled</code></a> to
check whether the event would be enabled. This allows <code>Layer</code>s to
elide constructing the event if it would not be recorded.</li>
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns a <ahref="../registry/struct.SpanRef.html"title="struct tracing_subscriber::registry::SpanRef"><code>SpanRef</code></a> for the parent span of the given <ahref="../../tracing_core/event/struct.Event.html"title="struct tracing_core::event::Event"><code>Event</code></a>, if
it has a parent.</p>
<p>If the event has an explicitly overridden parent, this method returns
a reference to that span. If the event’s parent is the current span,
this returns a reference to the current span, if there is one. If this
returns <code>None</code>, then either the event’s parent was explicitly set to
<code>None</code>, or the event’s parent was defined contextually, but no span
is currently entered.</p>
<p>Compared to <ahref="struct.Context.html#method.current_span"title="method tracing_subscriber::layer::Context::current_span"><code>Context::current_span</code></a> and <ahref="struct.Context.html#method.lookup_current"title="method tracing_subscriber::layer::Context::lookup_current"><code>Context::lookup_current</code></a>,
this respects overrides provided by the <ahref="../../tracing_core/event/struct.Event.html"title="struct tracing_core::event::Event"><code>Event</code></a>.</p>
<p>Compared to <ahref="../../tracing_core/event/struct.Event.html#method.parent"title="method tracing_core::event::Event::parent"><code>Event::parent</code></a>, this automatically falls back to the contextual
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns metadata for the span with the given <code>id</code>, if it exists.</p>
<p>If this returns <code>None</code>, then no span exists for that ID (either it has
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns <ahref="../registry/struct.SpanRef.html"title="struct tracing_subscriber::registry::SpanRef">stored data</a> for the span with the given <code>id</code>, if it exists.</p>
<p>If this returns <code>None</code>, then no span exists for that ID (either it has
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if an active span exists for the given <code>Id</code>.</p>
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns <ahref="../registry/struct.SpanRef.html"title="struct tracing_subscriber::registry::SpanRef">stored data</a> for the span that the wrapped subscriber considers
to be the current.</p>
<p>If this returns <code>None</code>, then we are not currently within a span.</p>
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns an iterator over the <ahref="../registry/struct.SpanRef.html"title="struct tracing_subscriber::registry::SpanRef">stored data</a> for all the spans in the
current context, starting with the specified span and ending with the
root of the trace tree and ending with the current span.</p>
S: for<'lookup><aclass="trait"href="../registry/trait.LookupSpan.html"title="trait tracing_subscriber::registry::LookupSpan">LookupSpan</a><'lookup>,</div></h4></section></summary><divclass="docblock"><p>Returns an iterator over the <ahref="../registry/struct.SpanRef.html"title="struct tracing_subscriber::registry::SpanRef">stored data</a> for all the spans in the
current context, starting with the parent span of the specified event,
and ending with the root of the trace tree and ending with the current span.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Instrument-for-T"class="impl"><aclass="src rightside"href="../../src/tracing/instrument.rs.html#325">source</a><ahref="#impl-Instrument-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="../../tracing/instrument/trait.Instrument.html"title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.instrument"class="method trait-impl"><aclass="src rightside"href="../../src/tracing/instrument.rs.html#86">source</a><ahref="#method.instrument"class="anchor">§</a><h4class="code-header">fn <ahref="../../tracing/instrument/trait.Instrument.html#method.instrument"class="fn">instrument</a>(self, span: <aclass="struct"href="../../tracing/span/struct.Span.html"title="struct tracing::span::Span">Span</a>) -><aclass="struct"href="../../tracing/instrument/struct.Instrumented.html"title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></section></summary><divclass='docblock'>Instruments this type with the provided <ahref="../../tracing/span/struct.Span.html"title="struct tracing::span::Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <ahref="../../tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.in_current_span"class="method trait-impl"><aclass="src rightside"href="../../src/tracing/instrument.rs.html#128">source</a><ahref="#method.in_current_span"class="anchor">§</a><h4class="code-header">fn <ahref="../../tracing/instrument/trait.Instrument.html#method.in_current_span"class="fn">in_current_span</a>(self) -><aclass="struct"href="../../tracing/instrument/struct.Instrumented.html"title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></section></summary><divclass='docblock'>Instruments this type with the <ahref="../../tracing/span/struct.Span.html#method.current"title="associated function tracing::span::Span::current">current</a><ahref="../../tracing/span/struct.Span.html"title="struct tracing::span::Span"><code>Span</code></a>, returning an
<code><ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#805-807">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#812">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#790-792">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#797">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-WithSubscriber-for-T"class="impl"><aclass="src rightside"href="../../src/tracing/instrument.rs.html#393">source</a><ahref="#impl-WithSubscriber-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="../../tracing/instrument/trait.WithSubscriber.html"title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_subscriber"class="method trait-impl"><aclass="src rightside"href="../../src/tracing/instrument.rs.html#176-178">source</a><ahref="#method.with_subscriber"class="anchor">§</a><h4class="code-header">fn <ahref="../../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber"class="fn">with_subscriber</a><S>(self, subscriber: S) -><aclass="struct"href="../../tracing/instrument/struct.WithDispatch.html"title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self><divclass="where">where
S: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="../../tracing_core/dispatcher/struct.Dispatch.html"title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>>,</div></h4></section></summary><divclass='docblock'>Attaches the provided <ahref="../../tracing_core/subscriber/trait.Subscriber.html"title="trait tracing_core::subscriber::Subscriber"><code>Subscriber</code></a> to this type, returning a
<ahref="../../tracing/instrument/struct.WithDispatch.html"title="struct tracing::instrument::WithDispatch"><code>WithDispatch</code></a> wrapper. <ahref="../../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_current_subscriber"class="method trait-impl"><aclass="src rightside"href="../../src/tracing/instrument.rs.html#228">source</a><ahref="#method.with_current_subscriber"class="anchor">§</a><h4class="code-header">fn <ahref="../../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber"class="fn">with_current_subscriber</a>(self) -><aclass="struct"href="../../tracing/instrument/struct.WithDispatch.html"title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></section></summary><divclass='docblock'>Attaches the current <ahref="../../tracing/dispatcher/index.html#setting-the-default-subscriber"title="mod tracing::dispatcher">default</a><ahref="../../tracing_core/subscriber/trait.Subscriber.html"title="trait tracing_core::subscriber::Subscriber"><code>Subscriber</code></a> to this type, returning a