difftastic/rustdoc/env_logger/struct.Builder.html

232 lines
52 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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="`Builder` acts as builder for initializing a `Logger`."><title>Builder in env_logger - Rust</title><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"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="env_logger" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="icon" href="https://www.rust-lang.org/static/images/favicon.ico"></head><body class="rustdoc struct"><!--[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="logo-container" href="../env_logger/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../env_logger/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" alt="logo"></a><h2><a href="../env_logger/index.html">env_logger</a><span class="version">0.10.2</span></h2></div><h2 class="location"><a href="#">Builder</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.build">build</a></li><li><a href="#method.default_format">default_format</a></li><li><a href="#method.filter">filter</a></li><li><a href="#method.filter_level">filter_level</a></li><li><a href="#method.filter_module">filter_module</a></li><li><a href="#method.format">format</a></li><li><a href="#method.format_indent">format_indent</a></li><li><a href="#method.format_level">format_level</a></li><li><a href="#method.format_module_path">format_module_path</a></li><li><a href="#method.format_suffix">format_suffix</a></li><li><a href="#method.format_target">format_target</a></li><li><a href="#method.format_timestamp">format_timestamp</a></li><li><a href="#method.format_timestamp_micros">format_timestamp_micros</a></li><li><a href="#method.format_timestamp_millis">format_timestamp_millis</a></li><li><a href="#method.format_timestamp_nanos">format_timestamp_nanos</a></li><li><a href="#method.format_timestamp_secs">format_timestamp_secs</a></li><li><a href="#method.from_default_env">from_default_env</a></li><li><a href="#method.from_env">from_env</a></li><li><a href="#method.init">init</a></li><li><a href="#method.is_test">is_test</a></li><li><a href="#method.new">new</a></li><li><a href="#method.parse_default_env">parse_default_env</a></li><li><a href="#method.parse_env">parse_env</a></li><li><a href="#method.parse_filters">parse_filters</a></li><li><a href="#method.parse_write_style">parse_write_style</a></li><li><a href="#method.target">target</a></li><li><a href="#method.try_init">try_init</a></li><li><a href="#method.write_style">write_style</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Builder">Debug</a></li><li><a href="#impl-Default-for-Builder">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Builder">!RefUnwindSafe</a></li><li><a href="#impl-Sync-for-Builder">!Sync</a></li><li><a href="#impl-UnwindSafe-for-Builder">!UnwindSafe</a></li><li><a href="#impl-Send-for-Builder">Send</a></li><li><a href="#impl-Unpin-for-Builder">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&lt;U&gt;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In crate env_logger</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="../env_logger/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>Struct <a href="index.html">env_logger</a>::<wbr><a class="struct" href="#">Builder</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/env_logger/logger.rs.html#40-45">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Builder { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>Builder</code> acts as builder for initializing a <code>Logger</code>.</p>
<p>It can be used to customize the log format, change the environment variable used
to provide the logging directives and also set the default log level filter.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::Builder;
<span class="kw">use </span>log::{LevelFilter, error, info};
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::from_default_env();
builder
.format(|buf, record| <span class="macro">writeln!</span>(buf, <span class="string">"{} - {}"</span>, record.level(), record.args()))
.filter(<span class="prelude-val">None</span>, LevelFilter::Info)
.init();
<span class="macro">error!</span>(<span class="string">"error message"</span>);
<span class="macro">info!</span>(<span class="string">"info message"</span>);</code></pre></div>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Builder" class="impl"><a class="src rightside" href="../src/env_logger/logger.rs.html#47-496">source</a><a href="#impl-Builder" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#74-76">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Initializes the log builder with defaults.</p>
<p><strong>NOTE:</strong> This method wont read from any environment variables.
Use the <a href="#method.filter"><code>filter</code></a> and <a href="#method.write_style"><code>write_style</code></a> methods to configure the builder
or use <a href="#method.from_env"><code>from_env</code></a> or <a href="#method.from_default_env"><code>from_default_env</code></a> instead.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<p>Create a new builder and configure filters and style:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>log::LevelFilter;
<span class="kw">use </span>env_logger::{Builder, WriteStyle};
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder
.filter(<span class="prelude-val">None</span>, LevelFilter::Info)
.write_style(WriteStyle::Always)
.init();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_env" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#106-113">source</a><h4 class="code-header">pub fn <a href="#method.from_env" class="fn">from_env</a>&lt;'a, E&gt;(env: E) -&gt; Self<div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Env.html" title="struct env_logger::Env">Env</a>&lt;'a&gt;&gt;,</div></h4></section></summary><div class="docblock"><p>Initializes the log builder from the environment.</p>
<p>The variables used to read configuration from can be tweaked before
passing in.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<p>Initialise a logger reading the log filter from an environment variable
called <code>MY_LOG</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::Builder;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::from_env(<span class="string">"MY_LOG"</span>);
builder.init();</code></pre></div>
<p>Initialise a logger using the <code>MY_LOG</code> variable for filtering and
<code>MY_LOG_STYLE</code> for whether or not to write styles:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::{Builder, Env};
<span class="kw">let </span>env = Env::new().filter(<span class="string">"MY_LOG"</span>).write_style(<span class="string">"MY_LOG_STYLE"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::from_env(env);
builder.init();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_env" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#151-166">source</a><h4 class="code-header">pub fn <a href="#method.parse_env" class="fn">parse_env</a>&lt;'a, E&gt;(&amp;mut self, env: E) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a><div class="where">where
E: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Env.html" title="struct env_logger::Env">Env</a>&lt;'a&gt;&gt;,</div></h4></section></summary><div class="docblock"><p>Applies the configuration from the environment.</p>
<p>This function allows a builder to be configured with default parameters,
to be then overridden by the environment.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<p>Initialise a logger with filter level <code>Off</code>, then override the log
filter from an environment variable called <code>MY_LOG</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>log::LevelFilter;
<span class="kw">use </span>env_logger::Builder;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.filter_level(LevelFilter::Off);
builder.parse_env(<span class="string">"MY_LOG"</span>);
builder.init();</code></pre></div>
<p>Initialise a logger with filter level <code>Off</code>, then use the <code>MY_LOG</code>
variable to override filtering and <code>MY_LOG_STYLE</code> to override whether
or not to write styles:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>log::LevelFilter;
<span class="kw">use </span>env_logger::{Builder, Env};
<span class="kw">let </span>env = Env::new().filter(<span class="string">"MY_LOG"</span>).write_style(<span class="string">"MY_LOG_STYLE"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.filter_level(LevelFilter::Off);
builder.parse_env(env);
builder.init();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_default_env" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#186-188">source</a><h4 class="code-header">pub fn <a href="#method.from_default_env" class="fn">from_default_env</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Initializes the log builder from the environment using default variable names.</p>
<p>This method is a convenient way to call <code>from_env(Env::default())</code> without
having to use the <code>Env</code> type explicitly. The builder will use the
<a href="struct.Env.html#default-environment-variables">default environment variables</a>.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<p>Initialise a logger using the default environment variables:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::Builder;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::from_default_env();
builder.init();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_default_env" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#212-214">source</a><h4 class="code-header">pub fn <a href="#method.parse_default_env" class="fn">parse_default_env</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Applies the configuration from the environment using default variable names.</p>
<p>This method is a convenient way to call <code>parse_env(Env::default())</code> without
having to use the <code>Env</code> type explicitly. The builder will use the
<a href="struct.Env.html#default-environment-variables">default environment variables</a>.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<p>Initialise a logger with filter level <code>Off</code>, then configure it using the
default environment variables:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>log::LevelFilter;
<span class="kw">use </span>env_logger::Builder;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.filter_level(LevelFilter::Off);
builder.parse_default_env();
builder.init();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#242-248">source</a><h4 class="code-header">pub fn <a href="#method.format" class="fn">format</a>&lt;F&gt;(&amp;mut self, format: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(&amp;mut <a class="struct" href="fmt/struct.Formatter.html" title="struct env_logger::fmt::Formatter">Formatter</a>, &amp;<a class="struct" href="../log/struct.Record.html" title="struct log::Record">Record</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Sets the format function for formatting the log output.</p>
<p>This function is called on each record logged and should format the
log record and output it to the given <a href="fmt/struct.Formatter.html"><code>Formatter</code></a>.</p>
<p>The format function is expected to output the string directly to the
<code>Formatter</code> so that implementations can use the <a href="https://doc.rust-lang.org/std/fmt/index.html"><code>std::fmt</code></a> macros
to format and output without intermediate heap allocations. The default
<code>env_logger</code> formatter takes advantage of this.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<p>Use a custom format to write only the log message:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io::Write;
<span class="kw">use </span>env_logger::Builder;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.format(|buf, record| <span class="macro">writeln!</span>(buf, <span class="string">"{}"</span>, record.args()));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_format" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#253-256">source</a><h4 class="code-header">pub fn <a href="#method.default_format" class="fn">default_format</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Use the default format.</p>
<p>This method will clear any custom format set on the builder.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_level" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#259-262">source</a><h4 class="code-header">pub fn <a href="#method.format_level" class="fn">format_level</a>(&amp;mut self, write: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Whether or not to write the level in the default format.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_module_path" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#265-268">source</a><h4 class="code-header">pub fn <a href="#method.format_module_path" class="fn">format_module_path</a>(&amp;mut self, write: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Whether or not to write the module path in the default format.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_target" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#271-274">source</a><h4 class="code-header">pub fn <a href="#method.format_target" class="fn">format_target</a>(&amp;mut self, write: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Whether or not to write the target in the default format.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_indent" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#278-281">source</a><h4 class="code-header">pub fn <a href="#method.format_indent" class="fn">format_indent</a>(&amp;mut self, indent: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures the amount of spaces to use to indent multiline log records.
A value of <code>None</code> disables any kind of indentation.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_timestamp" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#284-287">source</a><h4 class="code-header">pub fn <a href="#method.format_timestamp" class="fn">format_timestamp</a>(
&amp;mut self,
timestamp: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="fmt/enum.TimestampPrecision.html" title="enum env_logger::fmt::TimestampPrecision">TimestampPrecision</a>&gt;
) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures if timestamp should be included and in what precision.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_timestamp_secs" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#290-292">source</a><h4 class="code-header">pub fn <a href="#method.format_timestamp_secs" class="fn">format_timestamp_secs</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures the timestamp to use second precision.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_timestamp_millis" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#295-297">source</a><h4 class="code-header">pub fn <a href="#method.format_timestamp_millis" class="fn">format_timestamp_millis</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures the timestamp to use millisecond precision.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_timestamp_micros" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#300-302">source</a><h4 class="code-header">pub fn <a href="#method.format_timestamp_micros" class="fn">format_timestamp_micros</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures the timestamp to use microsecond precision.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_timestamp_nanos" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#305-307">source</a><h4 class="code-header">pub fn <a href="#method.format_timestamp_nanos" class="fn">format_timestamp_nanos</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures the timestamp to use nanosecond precision.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_suffix" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#310-313">source</a><h4 class="code-header">pub fn <a href="#method.format_suffix" class="fn">format_suffix</a>(&amp;mut self, suffix: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Configures the end of line suffix.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.filter_module" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#329-332">source</a><h4 class="code-header">pub fn <a href="#method.filter_module" class="fn">filter_module</a>(&amp;mut self, module: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>, level: <a class="enum" href="../log/enum.LevelFilter.html" title="enum log::LevelFilter">LevelFilter</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Adds a directive to the filter for a specific module.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<p>Only include messages for info and above for logs in <code>path::to::module</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::Builder;
<span class="kw">use </span>log::LevelFilter;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.filter_module(<span class="string">"path::to::module"</span>, LevelFilter::Info);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.filter_level" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#348-351">source</a><h4 class="code-header">pub fn <a href="#method.filter_level" class="fn">filter_level</a>(&amp;mut self, level: <a class="enum" href="../log/enum.LevelFilter.html" title="enum log::LevelFilter">LevelFilter</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Adds a directive to the filter for all modules.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<p>Only include messages for info and above for logs globally:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::Builder;
<span class="kw">use </span>log::LevelFilter;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.filter_level(LevelFilter::Info);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.filter" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#370-373">source</a><h4 class="code-header">pub fn <a href="#method.filter" class="fn">filter</a>(&amp;mut self, module: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>&gt;, level: <a class="enum" href="../log/enum.LevelFilter.html" title="enum log::LevelFilter">LevelFilter</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Adds filters to the logger.</p>
<p>The given module (if any) will log at most the specified level provided.
If no module is provided then the filter will apply to all log messages.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<p>Only include messages for info and above for logs in <code>path::to::module</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::Builder;
<span class="kw">use </span>log::LevelFilter;
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.filter(<span class="prelude-val">Some</span>(<span class="string">"path::to::module"</span>), LevelFilter::Info);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_filters" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#379-382">source</a><h4 class="code-header">pub fn <a href="#method.parse_filters" class="fn">parse_filters</a>(&amp;mut self, filters: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Parses the directives string in the same form as the <code>RUST_LOG</code>
environment variable.</p>
<p>See the module documentation for more details.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.target" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#402-405">source</a><h4 class="code-header">pub fn <a href="#method.target" class="fn">target</a>(&amp;mut self, target: <a class="enum" href="fmt/enum.Target.html" title="enum env_logger::fmt::Target">Target</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Sets the target for the log output.</p>
<p>Env logger can log to either stdout, stderr or a custom pipe. The default is stderr.</p>
<p>The custom pipe can be used to send the log messages to a custom sink (for example a file).
Do note that direct writes to a file can become a bottleneck due to IO operation times.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<p>Write log message to <code>stdout</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::{Builder, Target};
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.target(Target::Stdout);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.write_style" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#423-426">source</a><h4 class="code-header">pub fn <a href="#method.write_style" class="fn">write_style</a>(&amp;mut self, write_style: <a class="enum" href="fmt/enum.WriteStyle.html" title="enum env_logger::fmt::WriteStyle">WriteStyle</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Sets whether or not styles will be written.</p>
<p>This can be useful in environments that dont support control characters
for setting colors.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<p>Never attempt to write styles:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>env_logger::{Builder, WriteStyle};
<span class="kw">let </span><span class="kw-2">mut </span>builder = Builder::new();
builder.write_style(WriteStyle::Never);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_write_style" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#432-435">source</a><h4 class="code-header">pub fn <a href="#method.parse_write_style" class="fn">parse_write_style</a>(&amp;mut self, write_style: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Parses whether or not to write styles in the same form as the <code>RUST_LOG_STYLE</code>
environment variable.</p>
<p>See the module documentation for more details.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_test" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#441-444">source</a><h4 class="code-header">pub fn <a href="#method.is_test" class="fn">is_test</a>(&amp;mut self, is_test: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut Self</a></h4></section></summary><div class="docblock"><p>Sets whether or not the logger will be used in unit tests.</p>
<p>If <code>is_test</code> is <code>true</code> then the logger will allow the testing framework to
capture log records rather than printing them to the terminal directly.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_init" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#455-466">source</a><h4 class="code-header">pub fn <a href="#method.try_init" class="fn">try_init</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a>, <a class="struct" href="../log/struct.SetLoggerError.html" title="struct log::SetLoggerError">SetLoggerError</a>&gt;</h4></section></summary><div class="docblock"><p>Initializes the global logger with the built env logger.</p>
<p>This should be called early in the execution of a Rust program. Any log
events that occur before initialization will be ignored.</p>
<h5 id="errors"><a href="#errors">Errors</a></h5>
<p>This function will fail if it is called more than once, or if another
library has already initialized a global logger.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.init" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#477-480">source</a><h4 class="code-header">pub fn <a href="#method.init" class="fn">init</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Initializes the global logger with the built env logger.</p>
<p>This should be called early in the execution of a Rust program. Any log
events that occur before initialization will be ignored.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>This function will panic if it is called more than once, or if another
library has already initialized a global logger.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build" class="method"><a class="src rightside" href="../src/env_logger/logger.rs.html#486-495">source</a><h4 class="code-header">pub fn <a href="#method.build" class="fn">build</a>(&amp;mut self) -&gt; <a class="struct" href="struct.Logger.html" title="struct env_logger::Logger">Logger</a></h4></section></summary><div class="docblock"><p>Build an env logger.</p>
<p>The returned logger implements the <code>Log</code> trait and can be installed manually
or nested within another logger.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Builder" class="impl"><a class="src rightside" href="../src/env_logger/logger.rs.html#498-509">source</a><a href="#impl-Debug-for-Builder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/env_logger/logger.rs.html#499-508">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-Builder" class="impl"><a class="src rightside" href="../src/env_logger/logger.rs.html#39">source</a><a href="#impl-Default-for-Builder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/env_logger/logger.rs.html#39">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Builder" class="impl"><a href="#impl-RefUnwindSafe-for-Builder" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section><section id="impl-Send-for-Builder" class="impl"><a href="#impl-Send-for-Builder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section><section id="impl-Sync-for-Builder" class="impl"><a href="#impl-Sync-for-Builder" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section><section id="impl-Unpin-for-Builder" class="impl"><a href="#impl-Unpin-for-Builder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section><section id="impl-UnwindSafe-for-Builder" class="impl"><a href="#impl-UnwindSafe-for-Builder" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Builder.html" title="struct env_logger::Builder">Builder</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>