struct.Error.html 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Error` struct in crate `failure`."><meta name="keywords" content="rust, rustlang, rust-lang, Error"><title>failure::Error - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><p class='location'>Struct Error</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.from_boxed_compat">from_boxed_compat</a><a href="#method.as_fail">as_fail</a><a href="#method.cause">cause</a><a href="#method.backtrace">backtrace</a><a href="#method.context">context</a><a href="#method.compat">compat</a><a href="#method.downcast">downcast</a><a href="#method.find_root_cause">find_root_cause</a><a href="#method.iter_causes">iter_causes</a><a href="#method.iter_chain">iter_chain</a><a href="#method.downcast_ref">downcast_ref</a><a href="#method.downcast_mut">downcast_mut</a><a href="#method.root_cause">root_cause</a><a href="#method.causes">causes</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-From%3CError%3E">From&lt;Error&gt;</a><a href="#impl-ResultExt%3CT%2C%20Error%3E">ResultExt&lt;T, Error&gt;</a><a href="#impl-From%3CF%3E">From&lt;F&gt;</a><a href="#impl-Display">Display</a><a href="#impl-Debug">Debug</a><a href="#impl-AsRef%3CFail%3E">AsRef&lt;Fail&gt;</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div></div><p class='location'><a href='index.html'>failure</a></p><script>window.sidebarCurrent = {name: 'Error', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>failure</a>::<wbr><a class="struct" href=''>Error</a></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'>&#x2212;</span>]</a></span><a class='srclink' href='../src/failure/error/mod.rs.html#29-31' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust struct'>pub struct Error { /* fields omitted */ }</pre></div><div class='docblock'><p>The <code>Error</code> type, which can contain any failure.</p>
  2. <p>Functions which accumulate many kinds of errors should return this type.
  3. All failures can be converted into it, so functions which catch those
  4. errors can be tried with <code>?</code> inside of a function that returns this kind
  5. of error.</p>
  6. <p>In addition to implementing <code>Debug</code> and <code>Display</code>, this type carries <code>Backtrace</code>
  7. information, and can be downcast into the failure that underlies it for
  8. more detailed inspection.</p>
  9. </div>
  10. <h2 id='methods' class='small-section-header'>
  11. Methods<a href='#methods' class='anchor'></a>
  12. </h2>
  13. <h3 id='impl' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#41-180' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from_boxed_compat' class="method"><span id='from_boxed_compat.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.from_boxed_compat' class='fnname'>from_boxed_compat</a>(err: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;<a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">StdError</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static&gt;) -&gt; <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#63-65' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Creates an <code>Error</code> from <code>Box&lt;std::error::Error&gt;</code>.</p>
  14. <p>This method is useful for comparability with code,
  15. which does not use the <code>Fail</code> trait.</p>
  16. <h1 id="example" class="section-header"><a href="#example">Example</a></h1>
  17. <pre class="rust rust-example-rendered">
  18. <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span> <span class="kw">as</span> <span class="ident">StdError</span>;
  19. <span class="kw">use</span> <span class="ident">failure</span>::<span class="ident">Error</span>;
  20. <span class="kw">fn</span> <span class="ident">app_fn</span>() <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">i32</span>, <span class="ident">Error</span><span class="op">&gt;</span> {
  21. <span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">library_fn</span>().<span class="ident">map_err</span>(<span class="ident">Error</span>::<span class="ident">from_boxed_compat</span>)<span class="question-mark">?</span>;
  22. <span class="prelude-val">Ok</span>(<span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>)
  23. }
  24. <span class="kw">fn</span> <span class="ident">library_fn</span>() <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">i32</span>, <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">StdError</span> <span class="op">+</span> <span class="ident">Sync</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="lifetime">&#39;static</span><span class="op">&gt;&gt;</span> {
  25. <span class="prelude-val">Ok</span>(<span class="number">92</span>)
  26. }</pre>
  27. </div><h4 id='method.as_fail' class="method"><span id='as_fail.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.as_fail' class='fnname'>as_fail</a>(&amp;self) -&gt; &amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#69-71' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Return a reference to the underlying failure that this <code>Error</code>
  28. contains.</p>
  29. </div><h4 id='method.cause' class="method"><span id='cause.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.cause' class='fnname'>cause</a>(&amp;self) -&gt; &amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#80-82' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab deprecated'>Deprecated since 0.1.2<p>: please use 'as_fail()' method instead</p>
  30. </div></div><div class='docblock'><p>Returns a reference to the underlying cause of this <code>Error</code>. Unlike the
  31. method on <code>Fail</code>, this does not return an <code>Option</code>. The <code>Error</code> type
  32. always has an underlying failure.</p>
  33. <p>This method has been deprecated in favor of the [Error::as_fail] method,
  34. which does the same thing.</p>
  35. </div><h4 id='method.backtrace' class="method"><span id='backtrace.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.backtrace' class='fnname'>backtrace</a>(&amp;self) -&gt; &amp;<a class="struct" href="../failure/struct.Backtrace.html" title="struct failure::Backtrace">Backtrace</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#89-91' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Gets a reference to the <code>Backtrace</code> for this <code>Error</code>.</p>
  36. <p>If the failure this wrapped carried a backtrace, that backtrace will
  37. be returned. Otherwise, the backtrace will have been constructed at
  38. the point that failure was cast into the <code>Error</code> type.</p>
  39. </div><h4 id='method.context' class="method"><span id='context.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.context' class='fnname'>context</a>&lt;D:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;context: D<br>) -&gt; <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#106-108' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Provides context for this <code>Error</code>.</p>
  40. <p>This can provide additional information about this error, appropriate
  41. to the semantics of the current layer. That is, if you have a
  42. lower-level error, such as an IO error, you can provide additional context
  43. about what that error means in the context of your function. This
  44. gives users of this function more information about what has gone
  45. wrong.</p>
  46. <p>This takes any type that implements <code>Display</code>, as well as
  47. <code>Send</code>/<code>Sync</code>/<code>'static</code>. In practice, this means it can take a <code>String</code>
  48. or a string literal, or a failure, or some other custom context-carrying
  49. type.</p>
  50. </div><h4 id='method.compat' class="method"><span id='compat.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.compat' class='fnname'>compat</a>(self) -&gt; <a class="struct" href="../failure/struct.Compat.html" title="struct failure::Compat">Compat</a>&lt;<a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#115-117' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Wraps <code>Error</code> in a compatibility type.</p>
  51. <p>This type implements the <code>Error</code> trait from <code>std::error</code>. If you need
  52. to pass failure's <code>Error</code> to an interface that takes any <code>Error</code>, you
  53. can use this method to get a compatible type.</p>
  54. </div><h4 id='method.downcast' class="method"><span id='downcast.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.downcast' class='fnname'>downcast</a>&lt;T:&nbsp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#125-127' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to downcast this <code>Error</code> to a particular <code>Fail</code> type.</p>
  55. <p>This downcasts by value, returning an owned <code>T</code> if the underlying
  56. failure is of the type <code>T</code>. For this reason it returns a <code>Result</code> - in
  57. the case that the underlying error is of a different type, the
  58. original <code>Error</code> is returned.</p>
  59. </div><h4 id='method.find_root_cause' class="method"><span id='find_root_cause.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.find_root_cause' class='fnname'>find_root_cause</a>(&amp;self) -&gt; &amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#131-133' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns the &quot;root cause&quot; of this error - the last value in the
  60. cause chain which does not return an underlying <code>cause</code>.</p>
  61. </div><h4 id='method.iter_causes' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'f&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'f <a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>;</span></code></div></div><span id='iter_causes.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.iter_causes' class='fnname'>iter_causes</a>(&amp;self) -&gt; <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#139-141' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a iterator over the causes of this error with the cause
  62. of the fail as the first item and the <code>root_cause</code> as the final item.</p>
  63. <p>Use <code>iter_chain</code> to also include the fail of this error itself.</p>
  64. </div><h4 id='method.iter_chain' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'f&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'f <a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>;</span></code></div></div><span id='iter_chain.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.iter_chain' class='fnname'>iter_chain</a>(&amp;self) -&gt; <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#149-151' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a iterator over all fails up the chain from the current
  65. as the first item up to the <code>root_cause</code> as the final item.</p>
  66. <p>This means that the chain also includes the fail itself which
  67. means that it does <em>not</em> start with <code>cause</code>. To skip the outermost
  68. fail use <code>iter_causes</code> instead.</p>
  69. </div><h4 id='method.downcast_ref' class="method"><span id='downcast_ref.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.downcast_ref' class='fnname'>downcast_ref</a>&lt;T:&nbsp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#157-159' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to downcast this <code>Error</code> to a particular <code>Fail</code> type by
  70. reference.</p>
  71. <p>If the underlying error is not of type <code>T</code>, this will return <code>None</code>.</p>
  72. </div><h4 id='method.downcast_mut' class="method"><span id='downcast_mut.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.downcast_mut' class='fnname'>downcast_mut</a>&lt;T:&nbsp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#165-167' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to downcast this <code>Error</code> to a particular <code>Fail</code> type by
  73. mutable reference.</p>
  74. <p>If the underlying error is not of type <code>T</code>, this will return <code>None</code>.</p>
  75. </div><h4 id='method.root_cause' class="method"><span id='root_cause.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.root_cause' class='fnname'>root_cause</a>(&amp;self) -&gt; &amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#171-173' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab deprecated'>Deprecated since 0.1.2<p>: please use the 'find_root_cause()' method instead</p>
  76. </div></div><div class='docblock'><p>Deprecated alias to <code>find_root_cause</code>.</p>
  77. </div><h4 id='method.causes' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'f&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a>&lt;'f&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'f <a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>;</span></code></div></div><span id='causes.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.causes' class='fnname'>causes</a>(&amp;self) -&gt; <a class="struct" href="../failure/struct.Causes.html" title="struct failure::Causes">Causes</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#177-179' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab deprecated'>Deprecated since 0.1.2<p>: please use the 'iter_chain()' method instead</p>
  78. </div></div><div class='docblock'><p>Deprecated alias to <code>iter_causes</code>.</p>
  79. </div></div>
  80. <h2 id='implementations' class='small-section-header'>
  81. Trait Implementations<a href='#implementations' class='anchor'></a>
  82. </h2>
  83. <div id='implementations-list'><h3 id='impl-From%3CError%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;<a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">StdError</a>&gt;</code><a href='#impl-From%3CError%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/compat.rs.html#42-46' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;R&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;R&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;W&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(error: <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;<a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">StdError</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/compat.rs.html#43-45' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</p>
  84. </div></div><h3 id='impl-ResultExt%3CT%2C%20Error%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../failure/trait.ResultExt.html" title="trait failure::ResultExt">ResultExt</a>&lt;T, <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>&gt; for <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>&gt;</code><a href='#impl-ResultExt%3CT%2C%20Error%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/result_ext.rs.html#182-202' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.compat-1' class="method"><span id='compat.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../failure/trait.ResultExt.html#tymethod.compat' class='fnname'>compat</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../failure/struct.Compat.html" title="struct failure::Compat">Compat</a>&lt;<a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>&gt;&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/result_ext.rs.html#183-185' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Wraps the error in <code>Compat</code> to make it compatible with older error handling APIs that expect <code>std::error::Error</code>. <a href="../failure/trait.ResultExt.html#tymethod.compat">Read more</a></p>
  85. </div><h4 id='method.context-1' class="method"><span id='context.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../failure/trait.ResultExt.html#tymethod.context' class='fnname'>context</a>&lt;D&gt;(self, context: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/result_ext.rs.html#187-191' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Wraps the error type in a context type. <a href="../failure/trait.ResultExt.html#tymethod.context">Read more</a></p>
  86. </div><h4 id='method.with_context' class="method"><span id='with_context.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../failure/trait.ResultExt.html#tymethod.with_context' class='fnname'>with_context</a>&lt;F, D&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&amp;<a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a>) -&gt; D,<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/result_ext.rs.html#193-201' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Wraps the error type in a context type generated by looking at the error value. <a href="../failure/trait.ResultExt.html#tymethod.with_context">Read more</a></p>
  87. </div></div><h3 id='impl-From%3CF%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;F:&nbsp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;F&gt; for <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl-From%3CF%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#33-39' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-1' class="method"><span id='from.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(failure: F) -&gt; <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#34-38' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</p>
  88. </div></div><h3 id='impl-Display' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl-Display' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#182-186' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#183-185' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
  89. </div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl-Debug' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#188-197' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt-1' class="method"><span id='fmt.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#189-196' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
  90. </div></div><h3 id='impl-AsRef%3CFail%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt; for <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl-AsRef%3CFail%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#199-203' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.as_ref' class="method"><span id='as_ref.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&amp;self) -&gt; &amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/error/mod.rs.html#200-202' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</p>
  91. </div></div></div>
  92. <h2 id='synthetic-implementations' class='small-section-header'>
  93. Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a>
  94. </h2>
  95. <div id='synthetic-implementations-list'>
  96. <h3 id='impl-Send' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl-Send' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../failure/struct.Error.html" title="struct failure::Error">Error</a></code><a href='#impl-Sync' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "failure";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>