blob: c2fb51b004ce7a482c5c595200ae05ced05a17ae [file] [log] [blame]
<!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="Futures compatibility for `tracing`."><meta name="keywords" content="rust, rustlang, rust-lang, tracing_futures"><title>tracing_futures - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod crate"><!--[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">&#9776;</button><a class="sidebar-logo" href="../tracing_futures/index.html"><div class="logo-container"><img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../tracing_futures/index.html"><div class="logo-container">
<img src="https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png" alt="logo"></div></a><h2 class="location"><a href="#">Crate tracing_futures</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.2.5</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">tracing_futures</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/tracing_futures/lib.rs.html#1-707">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Futures compatibility for <a href="https://crates.io/crates/tracing"><code>tracing</code></a>.</p>
<h2 id="overview"><a href="#overview">Overview</a></h2>
<p><a href="https://crates.io/crates/tracing"><code>tracing</code></a> is a framework for instrumenting Rust programs to collect
structured, event-based diagnostic information. This crate provides utilities
for using <code>tracing</code> to instrument asynchronous code written using futures and
async/await.</p>
<p>The crate provides the following traits:</p>
<ul>
<li>
<p><a href="trait.Instrument.html"><code>Instrument</code></a> allows a <code>tracing</code> <a href="https://docs.rs/tracing/latest/tracing/span/index.html">span</a> to be attached to a future, sink,
stream, or executor.</p>
</li>
<li>
<p><a href="trait.WithSubscriber.html"><code>WithSubscriber</code></a> allows a <code>tracing</code> <a href="https://docs.rs/tracing/latest/tracing/subscriber/index.html"><code>Subscriber</code></a> to be attached to a
future, sink, stream, or executor.</p>
</li>
</ul>
<p><em>Compiler support: <a href="#supported-rust-versions">requires <code>rustc</code> 1.42+</a></em></p>
<h2 id="feature-flags"><a href="#feature-flags">Feature flags</a></h2>
<p>This crate provides a number of feature flags that enable compatibility
features with other crates in the asynchronous ecosystem:</p>
<ul>
<li>
<p><code>tokio</code>: Enables compatibility with the <code>tokio</code> crate, including
<a href="trait.Instrument.html"><code>Instrument</code></a> and <a href="trait.WithSubscriber.html"><code>WithSubscriber</code></a> implementations for
<code>tokio::executor::Executor</code>, <code>tokio::runtime::Runtime</code>, and
<code>tokio::runtime::current_thread</code>. Enabled by default.</p>
</li>
<li>
<p><code>tokio-executor</code>: Enables compatibility with the <code>tokio-executor</code>
crate, including <a href="trait.Instrument.html"><code>Instrument</code></a> and <a href="trait.WithSubscriber.html"><code>WithSubscriber</code></a>
implementations for types implementing <code>tokio_executor::Executor</code>.
This is intended primarily for use in crates which depend on
<code>tokio-executor</code> rather than <code>tokio</code>; in general the <code>tokio</code> feature
should be used instead.</p>
</li>
<li>
<p><code>std-future</code>: Enables compatibility with <code>std::future::Future</code>.</p>
</li>
<li>
<p><code>futures-01</code>: Enables compatibility with version 0.1.x of the <a href="https://crates.io/crates/futures"><code>futures</code></a>
crate.</p>
</li>
<li>
<p><code>futures-03</code>: Enables compatibility with version 0.3.x of the <code>futures</code>
crate’s <code>Spawn</code> and <code>LocalSpawn</code> traits.</p>
</li>
<li>
<p><code>tokio-alpha</code>: Enables compatibility with <code>tokio</code> 0.2’s alpha releases,
including the <code>tokio</code> 0.2 <code>Executor</code> and <code>TypedExecutor</code> traits.</p>
</li>
<li>
<p><code>std</code>: Depend on the Rust standard library.</p>
<p><code>no_std</code> users may disable this feature with <code>default-features = false</code>:</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
tracing-futures = { version = &quot;0.2.5&quot;, default-features = false }</code></pre></div></li>
</ul>
<p>The <code>tokio</code>, <code>std-future</code> and <code>std</code> features are enabled by default.</p>
<h3 id="supported-rust-versions"><a href="#supported-rust-versions">Supported Rust Versions</a></h3>
<p>Tracing is built against the latest stable release. The minimum supported
version is 1.42. The current Tracing version is not guaranteed to build on
Rust versions earlier than the minimum supported version.</p>
<p>Tracing follows the same compiler support policies as the rest of the Tokio
project. The current stable Rust compiler and the three most recent minor
versions before it will always be supported. For example, if the current
stable compiler version is 1.45, the minimum supported version will not be
increased past 1.42, three minor versions prior. Increasing the minimum
supported compiler version is not considered a semver breaking change as
long as doing so complies with this policy.</p>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="executor/index.html" title="tracing_futures::executor mod">executor</a></div><div class="item-right docblock-short">Implementations for <code>Instrument</code>ed future executors.</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Instrumented.html" title="tracing_futures::Instrumented struct">Instrumented</a></div><div class="item-right docblock-short">A future, stream, sink, or executor that has been instrumented with a <code>tracing</code> span.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.WithDispatch.html" title="tracing_futures::WithDispatch struct">WithDispatch</a></div><div class="item-right docblock-short">A future, stream, sink, or executor that has been instrumented with a
<code>tracing</code> subscriber.</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Instrument.html" title="tracing_futures::Instrument trait">Instrument</a></div><div class="item-right docblock-short">Extension trait allowing futures, streams, sinks, and executors to be
instrumented with a <code>tracing</code> <a href="https://docs.rs/tracing/latest/tracing/span/index.html">span</a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.WithSubscriber.html" title="tracing_futures::WithSubscriber trait">WithSubscriber</a></div><div class="item-right docblock-short">Extension trait allowing futures, streams, and sinks to be instrumented with
a <code>tracing</code> <a href="https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html"><code>Subscriber</code></a>.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="tracing_futures" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>