194 lines
64 KiB
HTML
194 lines
64 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="The `Error` type, a wrapper around a dynamic error type."><meta name="keywords" content="rust, rustlang, rust-lang, Error"><title>Error in anyhow - 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" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script 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 struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../anyhow/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.png" alt="logo"></div>
|
||
</a><h2 class="location">Struct Error</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.chain">chain</a><a href="#method.context">context</a><a href="#method.downcast">downcast</a><a href="#method.downcast_mut">downcast_mut</a><a href="#method.downcast_ref">downcast_ref</a><a href="#method.is">is</a><a href="#method.msg">msg</a><a href="#method.new">new</a><a href="#method.root_cause">root_cause</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-AsRef%3Cdyn%20Error%20+%20%27static%3E">AsRef<dyn Error + 'static></a><a href="#impl-AsRef%3Cdyn%20Error%20+%20Sync%20+%20Send%20+%20%27static%3E">AsRef<dyn Error + Sync + Send + 'static></a><a href="#impl-Debug">Debug</a><a href="#impl-Deref">Deref</a><a href="#impl-DerefMut">DerefMut</a><a href="#impl-Display">Display</a><a href="#impl-Drop">Drop</a><a href="#impl-From%3CE%3E">From<E></a><a href="#impl-From%3CError%3E">From<Error></a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3C!%3E">From<!></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><h2 class="location">Other items in<br><a href="index.html">anyhow</a></h2><div id="sidebar-vars" data-name="Error" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../anyhow/index.html"><img class="rust-logo" src="../rust-logo.png" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><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" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">anyhow</a>::<wbr><a class="struct" href="#">Error</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></span><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/anyhow/lib.rs.html#370-372" title="goto source code">[src]</a></span></h1><div class="docblock item-decl"><pre class="rust struct"><code><div class="code-attribute">#[repr(transparent)]</div>pub struct Error { /* fields omitted */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <code>Error</code> type, a wrapper around a dynamic error type.</p>
|
||
<p><code>Error</code> works a lot like <code>Box<dyn std::error::Error></code>, but with these
|
||
differences:</p>
|
||
<ul>
|
||
<li><code>Error</code> requires that the error is <code>Send</code>, <code>Sync</code>, and <code>'static</code>.</li>
|
||
<li><code>Error</code> guarantees that a backtrace is available, even if the underlying
|
||
error type does not provide one.</li>
|
||
<li><code>Error</code> is represented as a narrow pointer — exactly one word in
|
||
size instead of two.</li>
|
||
</ul>
|
||
<br>
|
||
<h2 id="display-representations" class="section-header"><a href="#display-representations">Display representations</a></h2>
|
||
<p>When you print an error object using “{}” or to_string(), only the outermost
|
||
underlying error or context is printed, not any of the lower level causes.
|
||
This is exactly as if you had called the Display impl of the error from
|
||
which you constructed your anyhow::Error.</p>
|
||
<div class="example-wrap"><pre class="language-console"><code>Failed to read instrs from ./path/to/instrs.json</code></pre></div>
|
||
<p>To print causes as well using anyhow’s default formatting of causes, use the
|
||
alternate selector “{:#}”.</p>
|
||
<div class="example-wrap"><pre class="language-console"><code>Failed to read instrs from ./path/to/instrs.json: No such file or directory (os error 2)</code></pre></div>
|
||
<p>The Debug format “{:?}” includes your backtrace if one was captured. Note
|
||
that this is the representation you get by default if you return an error
|
||
from <code>fn main</code> instead of printing it explicitly yourself.</p>
|
||
<div class="example-wrap"><pre class="language-console"><code>Error: Failed to read instrs from ./path/to/instrs.json
|
||
|
||
Caused by:
|
||
No such file or directory (os error 2)</code></pre></div>
|
||
<p>and if there is a backtrace available:</p>
|
||
<div class="example-wrap"><pre class="language-console"><code>Error: Failed to read instrs from ./path/to/instrs.json
|
||
|
||
Caused by:
|
||
No such file or directory (os error 2)
|
||
|
||
Stack backtrace:
|
||
0: <E as anyhow::context::ext::StdError>::ext_context
|
||
at /git/anyhow/src/backtrace.rs:26
|
||
1: core::result::Result<T,E>::map_err
|
||
at /git/rustc/src/libcore/result.rs:596
|
||
2: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::with_context
|
||
at /git/anyhow/src/context.rs:58
|
||
3: testing::main
|
||
at src/main.rs:5
|
||
4: std::rt::lang_start
|
||
at /git/rustc/src/libstd/rt.rs:61
|
||
5: main
|
||
6: __libc_start_main
|
||
7: _start</code></pre></div>
|
||
<p>To see a conventional struct-style Debug representation, use “{:#?}”.</p>
|
||
<div class="example-wrap"><pre class="language-console"><code>Error {
|
||
context: "Failed to read instrs from ./path/to/instrs.json",
|
||
source: Os {
|
||
code: 2,
|
||
kind: NotFound,
|
||
message: "No such file or directory",
|
||
},
|
||
}</code></pre></div>
|
||
<p>If none of the built-in representations are appropriate and you would prefer
|
||
to render the error and its cause chain yourself, it can be done something
|
||
like this:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">anyhow</span>::{<span class="ident">Context</span>, <span class="prelude-ty">Result</span>};
|
||
|
||
<span class="kw">fn</span> <span class="ident">main</span>() {
|
||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span> <span class="ident">try_main</span>() {
|
||
<span class="macro">eprintln!</span>(<span class="string">"ERROR: {}"</span>, <span class="ident">err</span>);
|
||
<span class="ident">err</span>.<span class="ident">chain</span>().<span class="ident">skip</span>(<span class="number">1</span>).<span class="ident">for_each</span>(<span class="op">|</span><span class="ident">cause</span><span class="op">|</span> <span class="macro">eprintln!</span>(<span class="string">"because: {}"</span>, <span class="ident">cause</span>));
|
||
<span class="ident">std::process::exit</span>(<span class="number">1</span>);
|
||
}
|
||
}
|
||
|
||
<span class="kw">fn</span> <span class="ident">try_main</span>() -> <span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
||
...
|
||
}</code></pre></div>
|
||
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#18-523" title="goto source code">[src]</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.new" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#30-36" title="goto source code">[src]</a></div><a href="#method.new" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a><E>(error: E) -> Self <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Create a new error object from any error type.</p>
|
||
<p>The error type must be threadsafe and <code>'static</code>, so that the <code>Error</code>
|
||
will be as well.</p>
|
||
<p>If the error type does not provide a backtrace, a backtrace will be
|
||
created here to ensure that a backtrace exists.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.msg" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#77-82" title="goto source code">[src]</a></div><a href="#method.msg" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.msg" class="fnname">msg</a><M>(message: M) -> Self <span class="where fmt-newline">where<br> M: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Create a new error object from a printable error message.</p>
|
||
<p>If the argument implements std::error::Error, prefer <code>Error::new</code>
|
||
instead which preserves the underlying error’s cause chain and
|
||
backtrace. If the argument may or may not implement std::error::Error
|
||
now or in the future, use <code>anyhow!(err)</code> which handles either way
|
||
correctly.</p>
|
||
<p><code>Error::msg("...")</code> is equivalent to <code>anyhow!("...")</code> but occasionally
|
||
convenient in places where a function is preferable over a macro, such
|
||
as iterator or stream combinators:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">anyhow</span>::{<span class="ident">Error</span>, <span class="prelude-ty">Result</span>};
|
||
<span class="kw">use</span> <span class="ident">futures::stream</span>::{<span class="ident">Stream</span>, <span class="ident">StreamExt</span>, <span class="ident">TryStreamExt</span>};
|
||
|
||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">demo</span><span class="op"><</span><span class="ident">S</span><span class="op">></span>(<span class="ident">stream</span>: <span class="ident">S</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="ident">Output</span><span class="op">></span><span class="op">></span>
|
||
<span class="kw">where</span>
|
||
<span class="ident">S</span>: <span class="ident">Stream</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">Input</span><span class="op">></span>,
|
||
{
|
||
<span class="ident">stream</span>
|
||
.<span class="ident">then</span>(<span class="ident">ffi::do_some_work</span>) <span class="comment">// returns Result<Output, &str></span>
|
||
.<span class="ident">map_err</span>(<span class="ident">Error::msg</span>)
|
||
.<span class="ident">try_collect</span>()
|
||
.<span class="kw">await</span>
|
||
}</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.context" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#299-327" title="goto source code">[src]</a></div><a href="#method.context" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.context" class="fnname">context</a><C>(self, context: C) -> Self <span class="where fmt-newline">where<br> C: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Wrap the error value with additional context.</p>
|
||
<p>For attaching context to a <code>Result</code> as it is propagated, the
|
||
<a href="trait.Context.html" title="crate::Context"><code>Context</code></a> extension trait may be more convenient than
|
||
this function.</p>
|
||
<p>The primary reason to use <code>error.context(...)</code> instead of
|
||
<code>result.context(...)</code> via the <code>Context</code> trait would be if the context
|
||
needs to depend on some data held by the underlying error:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">anyhow::Result</span>;
|
||
<span class="kw">use</span> <span class="ident">std::fs::File</span>;
|
||
<span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">struct</span> <span class="ident">ParseError</span> {
|
||
<span class="ident">line</span>: <span class="ident">usize</span>,
|
||
<span class="ident">column</span>: <span class="ident">usize</span>,
|
||
}
|
||
|
||
<span class="kw">fn</span> <span class="ident">parse_impl</span>(<span class="ident">file</span>: <span class="ident">File</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||
...
|
||
}
|
||
|
||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">path</span>: <span class="kw">impl</span> <span class="ident">AsRef</span><span class="op"><</span><span class="ident">Path</span><span class="op">></span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File::open</span>(<span class="kw-2">&</span><span class="ident">path</span>)<span class="question-mark">?</span>;
|
||
<span class="ident">parse_impl</span>(<span class="ident">file</span>).<span class="ident">map_err</span>(<span class="op">|</span><span class="ident">error</span><span class="op">|</span> {
|
||
<span class="kw">let</span> <span class="ident">context</span> <span class="op">=</span> <span class="macro">format!</span>(
|
||
<span class="string">"only the first {} lines of {} are valid"</span>,
|
||
<span class="ident">error</span>.<span class="ident">line</span>, <span class="ident">path</span>.<span class="ident">as_ref</span>().<span class="ident">display</span>(),
|
||
);
|
||
<span class="ident">anyhow::Error::new</span>(<span class="ident">error</span>).<span class="ident">context</span>(<span class="ident">context</span>)
|
||
})
|
||
}</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.chain" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#389-391" title="goto source code">[src]</a></div><a href="#method.chain" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.chain" class="fnname">chain</a>(&self) -> <a class="struct" href="struct.Chain.html" title="struct anyhow::Chain">Chain</a><'_><span class="notable-traits"><span class="notable-traits-tooltip">ⓘ<div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="struct" href="struct.Chain.html" title="struct anyhow::Chain">Chain</a><'a></div><code class="content"><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="struct.Chain.html" title="struct anyhow::Chain">Chain</a><'a></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.59.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="associatedtype">Item</a> = &'a (dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + 'static);</span></code></span></div></span></span></h4></div></summary><div class="docblock"><p>An iterator of the chain of source errors contained by this Error.</p>
|
||
<p>This iterator will visit every error in the cause chain of this error
|
||
object, beginning with the error that this error object was created
|
||
from.</p>
|
||
<h5 id="example" class="section-header"><a href="#example">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">anyhow::Error</span>;
|
||
<span class="kw">use</span> <span class="ident">std::io</span>;
|
||
|
||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">underlying_io_error_kind</span>(<span class="ident">error</span>: <span class="kw-2">&</span><span class="ident">Error</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">io::ErrorKind</span><span class="op">></span> {
|
||
<span class="kw">for</span> <span class="ident">cause</span> <span class="kw">in</span> <span class="ident">error</span>.<span class="ident">chain</span>() {
|
||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">io_error</span>) <span class="op">=</span> <span class="ident">cause</span>.<span class="ident">downcast_ref</span>::<span class="op"><</span><span class="ident">io::Error</span><span class="op">></span>() {
|
||
<span class="kw">return</span> <span class="prelude-val">Some</span>(<span class="ident">io_error</span>.<span class="ident">kind</span>());
|
||
}
|
||
}
|
||
<span class="prelude-val">None</span>
|
||
}</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.root_cause" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#400-402" title="goto source code">[src]</a></div><a href="#method.root_cause" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.root_cause" class="fnname">root_cause</a>(&self) -> &(dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + 'static)</h4></div></summary><div class="docblock"><p>The lowest level cause of this error — this error’s cause’s
|
||
cause’s cause etc.</p>
|
||
<p>The root cause is the last error in the iterator produced by
|
||
<a href="struct.Error.html#method.chain" title="Error::chain"><code>chain()</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#412-417" title="goto source code">[src]</a></div><a href="#method.is" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is" class="fnname">is</a><E>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Returns true if <code>E</code> is the type held by this error object.</p>
|
||
<p>For errors with context, this method returns true if <code>E</code> matches the
|
||
type of the context <code>C</code> <strong>or</strong> the type of the error on which the
|
||
context has been attached. For details about the interaction between
|
||
context and downcasting, <a href="trait.Context.html#effect-on-downcasting">see here</a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.downcast" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#420-452" title="goto source code">[src]</a></div><a href="#method.downcast" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.downcast" class="fnname">downcast</a><E>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><E, Self> <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Attempt to downcast the error object to a concrete type.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.downcast_ref" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#490-501" title="goto source code">[src]</a></div><a href="#method.downcast_ref" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.downcast_ref" class="fnname">downcast_ref</a><E>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>E> <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Downcast this error object by reference.</p>
|
||
<h5 id="example-1" class="section-header"><a href="#example-1">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// If the error was caused by redaction, then return a tombstone instead</span>
|
||
<span class="comment">// of the content.</span>
|
||
<span class="kw">match</span> <span class="ident">root_cause</span>.<span class="ident">downcast_ref</span>::<span class="op"><</span><span class="ident">DataStoreError</span><span class="op">></span>() {
|
||
<span class="prelude-val">Some</span>(<span class="ident">DataStoreError::Censored</span>(<span class="kw">_</span>)) => <span class="prelude-val">Ok</span>(<span class="ident">Poll::Ready</span>(<span class="ident">REDACTED_CONTENT</span>)),
|
||
<span class="prelude-val">None</span> => <span class="prelude-val">Err</span>(<span class="ident">error</span>),
|
||
}</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.downcast_mut" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#504-522" title="goto source code">[src]</a></div><a href="#method.downcast_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.downcast_mut" class="fnname">downcast_mut</a><E>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>E> <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Downcast this error object by mutable reference.</p>
|
||
</div></details></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-AsRef%3Cdyn%20Error%20+%20%27static%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#966-970" title="goto source code">[src]</a></div><a href="#impl-AsRef%3Cdyn%20Error%20+%20%27static%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#967-969" title="goto source code">[src]</a></div><a href="#method.as_ref-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&self) -> &(dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + 'static)</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-AsRef%3Cdyn%20Error%20+%20Sync%20+%20Send%20+%20%27static%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#959-963" title="goto source code">[src]</a></div><a href="#impl-AsRef%3Cdyn%20Error%20+%20Sync%20+%20Send%20+%20%27static%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#960-962" title="goto source code">[src]</a></div><a href="#method.as_ref" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&self) -> &(dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static)</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#562-566" title="goto source code">[src]</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#563-565" title="goto source code">[src]</a></div><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Deref" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#540-546" title="goto source code">[src]</a></div><a href="#impl-Deref" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Target" class="type trait-impl has-srclink"><a href="#associatedtype.Target" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static</h4></div></summary><div class='docblock'><p>The resulting type after dereferencing.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.deref" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#543-545" title="goto source code">[src]</a></div><a href="#method.deref" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.Deref.html#tymethod.deref" class="fnname">deref</a>(&self) -> &Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4></div></summary><div class='docblock'><p>Dereferences the value.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-DerefMut" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#550-554" title="goto source code">[src]</a></div><a href="#impl-DerefMut" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.deref_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#551-553" title="goto source code">[src]</a></div><a href="#method.deref_mut" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut" class="fnname">deref_mut</a>(&mut self) -> &mut Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4></div></summary><div class='docblock'><p>Mutably dereferences the value.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Display" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#556-560" title="goto source code">[src]</a></div><a href="#impl-Display" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#557-559" title="goto source code">[src]</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Drop" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#568-575" title="goto source code">[src]</a></div><a href="#impl-Drop" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.drop" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#569-574" title="goto source code">[src]</a></div><a href="#method.drop" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&mut self)</h4></div></summary><div class='docblock'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.59.0/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CE%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#527-536" title="goto source code">[src]</a></div><a href="#impl-From%3CE%3E" class="anchor"></a><h3 class="code-header in-band">impl<E> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><E> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a> <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#532-535" title="goto source code">[src]</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(error: E) -> Self</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CError%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#934-944" title="goto source code">[src]</a></div><a href="#impl-From%3CError%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#936-943" title="goto source code">[src]</a></div><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(error: <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a>) -> Self</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CError%3E-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#946-950" title="goto source code">[src]</a></div><a href="#impl-From%3CError%3E-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#947-949" title="goto source code">[src]</a></div><a href="#method.from-2" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(error: <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a>) -> Self</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CError%3E-2" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#952-956" title="goto source code">[src]</a></div><a href="#impl-From%3CError%3E-2" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + 'static></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-3" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/anyhow/error.rs.html#953-955" title="goto source code">[src]</a></div><a href="#method.from-3" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(error: <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a>) -> Self</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/any.rs.html#132-136" title="goto source code">[src]</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/any.rs.html#133" title="goto source code">[src]</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#209-214" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#211" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#218-222" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#219" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3C!%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#566-570" title="goto source code">[src]</a></div><a href="#impl-From%3C!%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.never.html">!</a>> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-4" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#567" title="goto source code">[src]</a></div><a href="#method.from-4" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.never.html">!</a>) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#550-554" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-5" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#551" title="goto source code">[src]</a></div><a href="#method.from-5" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#538-545" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#542" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ToString" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/alloc/string.rs.html#2388-2402" title="goto source code">[src]</a></div><a href="#impl-ToString" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_string" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/alloc/string.rs.html#2394" title="goto source code">[src]</a></div><a href="#method.to_string" class="anchor"></a><h4 class="code-header">pub default fn <a href="https://doc.rust-lang.org/1.59.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></div></summary><div class='docblock'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/1.59.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#588-597" title="goto source code">[src]</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#594" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#574-583" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#580" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details></div></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="anyhow" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.59.0 (9d1b2106e 2022-02-23)" ></div>
|
||
</body></html> |