44 lines
8.7 KiB
HTML
44 lines
8.7 KiB
HTML
<!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 `field` mod in crate `tracing_core`."><meta name="keywords" content="rust, rustlang, rust-lang, field"><title>tracing_core::field - 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 mod"><!--[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">☰</div><a href='../../tracing_core/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">Module field</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class="location"><a href="../index.html">tracing_core</a></p><script>window.sidebarCurrent = {name: "field", ty: "mod", relpath: "../"};</script><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="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/tracing_core/field.rs.html#1-980" title="goto source code">[src]</a></span><span class="in-band">Module <a href="../index.html">tracing_core</a>::<wbr><a class="mod" href="">field</a></span></h1><div class="docblock"><p>Span and <code>Event</code> key-value data.</p>
|
||
<p>Spans and events may be annotated with key-value data, referred to as known
|
||
as <em>fields</em>. These fields consist of a mapping from a key (corresponding to
|
||
a <code>&str</code> but represented internally as an array index) to a <a href="trait.Value.html"><code>Value</code></a>.</p>
|
||
<h1 id="values-and-subscribers" class="section-header"><a href="#values-and-subscribers"><code>Value</code>s and <code>Subscriber</code>s</a></h1>
|
||
<p><code>Subscriber</code>s consume <code>Value</code>s as fields attached to <a href="../span/">span</a>s or <a href="../event/struct.Event.html"><code>Event</code></a>s.
|
||
The set of field keys on a given span or is defined on its <a href="../metadata/struct.Metadata.html"><code>Metadata</code></a>.
|
||
When a span is created, it provides <a href="../span/struct.Attributes.html"><code>Attributes</code></a> to the <code>Subscriber</code>'s
|
||
<a href="../subscriber/trait.Subscriber.html#method.new_span"><code>new_span</code></a> method, containing any fields whose values were provided when
|
||
the span was created; and may call the <code>Subscriber</code>'s <a href="../span/struct.Record.html"><code>record</code></a> method
|
||
with additional <a href="../span/struct.Record.html"><code>Record</code></a>s if values are added for more of its fields.
|
||
Similarly, the <a href="../event/struct.Event.html"><code>Event</code></a> type passed to the subscriber's <a href="../event/struct.Event.html"><code>event</code></a> method
|
||
will contain any fields attached to each event.</p>
|
||
<p><code>tracing</code> represents values as either one of a set of Rust primitives
|
||
(<code>i64</code>, <code>u64</code>, <code>bool</code>, and <code>&str</code>) or using a <code>fmt::Display</code> or <code>fmt::Debug</code>
|
||
implementation. <code>Subscriber</code>s are provided these primitive value types as
|
||
<code>dyn Value</code> trait objects.</p>
|
||
<p>These trait objects can be formatted using <code>fmt::Debug</code>, but may also be
|
||
recorded as typed data by calling the <a href="trait.Value.html#method.record"><code>Value::record</code></a> method on these
|
||
trait objects with a <em>visitor</em> implementing the <a href="trait.Visit.html"><code>Visit</code></a> trait. This trait
|
||
represents the behavior used to record values of various types. For example,
|
||
we might record integers by incrementing counters for their field names,
|
||
rather than printing them.</p>
|
||
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||
<table><tr class="module-item"><td><a class="struct" href="struct.DebugValue.html" title="tracing_core::field::DebugValue struct">DebugValue</a></td><td class="docblock-short"><p>A <code>Value</code> which serializes as a string using <code>fmt::Debug</code>.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.DisplayValue.html" title="tracing_core::field::DisplayValue struct">DisplayValue</a></td><td class="docblock-short"><p>A <code>Value</code> which serializes using <code>fmt::Display</code>.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Empty.html" title="tracing_core::field::Empty struct">Empty</a></td><td class="docblock-short"><p>An empty field.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Field.html" title="tracing_core::field::Field struct">Field</a></td><td class="docblock-short"><p>An opaque key allowing <em>O</em>(1) access to a field in a <code>Span</code>'s key-value
|
||
data.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.FieldSet.html" title="tracing_core::field::FieldSet struct">FieldSet</a></td><td class="docblock-short"><p>Describes the fields present on a span.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Iter.html" title="tracing_core::field::Iter struct">Iter</a></td><td class="docblock-short"><p>An iterator over a set of fields.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ValueSet.html" title="tracing_core::field::ValueSet struct">ValueSet</a></td><td class="docblock-short"><p>A set of fields and values for a span.</p>
|
||
</td></tr></table><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||
<table><tr class="module-item"><td><a class="trait" href="trait.Value.html" title="tracing_core::field::Value trait">Value</a></td><td class="docblock-short"><p>A field value of an erased type.</p>
|
||
</td></tr><tr class="module-item"><td><a class="trait" href="trait.Visit.html" title="tracing_core::field::Visit trait">Visit</a></td><td class="docblock-short"><p>Visits typed values.</p>
|
||
</td></tr></table><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
|
||
<table><tr class="module-item"><td><a class="fn" href="fn.debug.html" title="tracing_core::field::debug fn">debug</a></td><td class="docblock-short"><p>Wraps a type implementing <code>fmt::Debug</code> as a <code>Value</code> that can be
|
||
recorded using its <code>Debug</code> implementation.</p>
|
||
</td></tr><tr class="module-item"><td><a class="fn" href="fn.display.html" title="tracing_core::field::display fn">display</a></td><td class="docblock-short"><p>Wraps a type implementing <code>fmt::Display</code> as a <code>Value</code> that can be
|
||
recorded using its <code>Display</code> implementation.</p>
|
||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "tracing_core";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html> |