trait.Fail.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 `Fail` trait in crate `failure`."><meta name="keywords" content="rust, rustlang, rust-lang, Fail"><title>failure::Fail - 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 trait"><!--[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'>Trait Fail</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.cause">cause</a><a href="#method.backtrace">backtrace</a><a href="#method.context">context</a><a href="#method.compat">compat</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Fail">Box&lt;Fail&gt;</a></div><a class="sidebar-title" href="#implementors">Implementors</a><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.downcast_ref">downcast_ref</a><a href="#method.downcast_mut">downcast_mut</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.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-AsRef%3CFail%3E">AsRef&lt;Fail&gt;</a></div></div><p class='location'><a href='index.html'>failure</a></p><script>window.sidebarCurrent = {name: 'Fail', ty: 'trait', 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'>Trait <a href='index.html'>failure</a>::<wbr><a class="trait" href=''>Fail</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/lib.rs.html#106-185' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust trait'>pub trait Fail: <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/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</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 {
  2. fn <a href='#method.cause' class='fnname'>cause</a>(&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;&amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt; { ... }
  3. <div class='item-spacer'></div> fn <a href='#method.backtrace' class='fnname'>backtrace</a>(&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;&amp;<a class="struct" href="../failure/struct.Backtrace.html" title="struct failure::Backtrace">Backtrace</a>&gt; { ... }
  4. <div class='item-spacer'></div> fn <a href='#method.context' class='fnname'>context</a>&lt;D&gt;(self, context: D) -&gt; <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&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,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
  5. { ... }
  6. <div class='item-spacer'></div> 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;Self&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
  7. { ... }
  8. }</pre></div><div class='docblock'><p>The <code>Fail</code> trait.</p>
  9. <p>Implementors of this trait are called 'failures'.</p>
  10. <p>All error types should implement <code>Fail</code>, which provides a baseline of
  11. functionality that they all share.</p>
  12. <p><code>Fail</code> has no required methods, but it does require that your type
  13. implement several other traits:</p>
  14. <ul>
  15. <li><code>Display</code>: to print a user-friendly representation of the error.</li>
  16. <li><code>Debug</code>: to print a verbose, developer-focused representation of the
  17. error.</li>
  18. <li><code>Send + Sync</code>: Your error type is required to be safe to transfer to and
  19. reference from another thread</li>
  20. </ul>
  21. <p>Additionally, all failures must be <code>'static</code>. This enables downcasting.</p>
  22. <p><code>Fail</code> provides several methods with default implementations. Two of these
  23. may be appropriate to override depending on the definition of your
  24. particular failure: the <code>cause</code> and <code>backtrace</code> methods.</p>
  25. <p>The <code>failure_derive</code> crate provides a way to derive the <code>Fail</code> trait for
  26. your type. Additionally, all types that already implement
  27. <code>std::error::Error</code>, and are also <code>Send</code>, <code>Sync</code>, and <code>'static</code>, implement
  28. <code>Fail</code> by a blanket impl.</p>
  29. </div>
  30. <h2 id='provided-methods' class='small-section-header'>
  31. Provided Methods<a href='#provided-methods' class='anchor'></a>
  32. </h2>
  33. <div class='methods'>
  34. <h3 id='method.cause' class='method'><span id='cause.v' class='invisible'><code>fn <a href='#method.cause' class='fnname'>cause</a>(&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;&amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt;</code></span></h3><div class='docblock'><p>Returns a reference to the underlying cause of this failure, if it
  35. is an error that wraps other errors.</p>
  36. <p>Returns <code>None</code> if this failure does not have another error as its
  37. underlying cause. By default, this returns <code>None</code>.</p>
  38. <p>This should <strong>never</strong> return a reference to <code>self</code>, but only return
  39. <code>Some</code> when it can return a <strong>different</strong> failure. Users may loop
  40. over the cause chain, and returning <code>self</code> would result in an infinite
  41. loop.</p>
  42. </div><h3 id='method.backtrace' class='method'><span id='backtrace.v' class='invisible'><code>fn <a href='#method.backtrace' class='fnname'>backtrace</a>(&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;&amp;<a class="struct" href="../failure/struct.Backtrace.html" title="struct failure::Backtrace">Backtrace</a>&gt;</code></span></h3><div class='docblock'><p>Returns a reference to the <code>Backtrace</code> carried by this failure, if it
  43. carries one.</p>
  44. <p>Returns <code>None</code> if this failure does not carry a backtrace. By
  45. default, this returns <code>None</code>.</p>
  46. </div><h3 id='method.context' class='method'><span id='context.v' class='invisible'><code>fn <a href='#method.context' class='fnname'>context</a>&lt;D&gt;(self, context: D) -&gt; <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&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,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code></span></h3><div class='docblock'><p>Provides context for this failure.</p>
  47. <p>This can provide additional information about this error, appropriate
  48. to the semantics of the current layer. That is, if you have a
  49. lower-level error, such as an IO error, you can provide additional context
  50. about what that error means in the context of your function. This
  51. gives users of this function more information about what has gone
  52. wrong.</p>
  53. <p>This takes any type that implements <code>Display</code>, as well as
  54. <code>Send</code>/<code>Sync</code>/<code>'static</code>. In practice, this means it can take a <code>String</code>
  55. or a string literal, or another failure, or some other custom context-carrying
  56. type.</p>
  57. </div><h3 id='method.compat' class='method'><span id='compat.v' class='invisible'><code>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;Self&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code></span></h3><div class='docblock'><p>Wraps this failure in a compatibility wrapper that implements
  58. <code>std::error::Error</code>.</p>
  59. <p>This allows failures to be compatible with older crates that
  60. expect types that implement the <code>Error</code> trait from <code>std::error</code>.</p>
  61. </div></div>
  62. <h2 id='methods' class='small-section-header'>
  63. Methods<a href='#methods' class='anchor'></a>
  64. </h2>
  65. <h3 id='impl' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</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/lib.rs.html#187-252' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><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/lib.rs.html#191-197' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to downcast this failure to a concrete type by reference.</p>
  66. <p>If the underlying error is not of type <code>T</code>, this will return <code>None</code>.</p>
  67. </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/lib.rs.html#203-209' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to downcast this failure to a concrete type by mutable
  68. reference.</p>
  69. <p>If the underlying error is not of type <code>T</code>, this will return <code>None</code>.</p>
  70. </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/lib.rs.html#219-221' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns the &quot;root cause&quot; of this <code>Fail</code> - the last value in the
  71. cause chain which does not return an underlying <code>cause</code>.</p>
  72. <p>If this type does not have a cause, <code>self</code> is returned, because
  73. it is its own root cause.</p>
  74. <p>This is equivalent to iterating over <code>iter_causes()</code> and taking
  75. the last item.</p>
  76. </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/lib.rs.html#227-229' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a iterator over the causes of this <code>Fail</code> with the cause
  77. of this fail as the first item and the <code>root_cause</code> as the final item.</p>
  78. <p>Use <code>iter_chain</code> to also include the fail itself.</p>
  79. </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/lib.rs.html#237-239' 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
  80. as the first item up to the <code>root_cause</code> as the final item.</p>
  81. <p>This means that the chain also includes the fail itself which
  82. means that it does <em>not</em> start with <code>cause</code>. To skip the outermost
  83. fail use <code>iter_causes</code> instead.</p>
  84. </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/lib.rs.html#243-245' 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>
  85. </div></div><div class='docblock'><p>Deprecated alias to <code>find_root_cause</code>.</p>
  86. </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/lib.rs.html#249-251' 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>
  87. </div></div><div class='docblock'><p>Deprecated alias to <code>iter_causes</code>.</p>
  88. </div></div>
  89. <h2 id='implementations' class='small-section-header'>
  90. Trait Implementations<a href='#implementations' class='anchor'></a>
  91. </h2>
  92. <div id='implementations-list'><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>
  93. </div></div></div>
  94. <h2 id='foreign-impls' class='small-section-header'>
  95. Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
  96. </h2>
  97. <h3 id='impl-Fail' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</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;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt;</code><a href='#impl-Fail' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/lib.rs.html#258-266' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.cause-1' class="method"><span id='cause.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.cause' class='fnname'>cause</a>(&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;&amp;<a class="trait" href="../failure/trait.Fail.html" title="trait failure::Fail">Fail</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/lib.rs.html#259-261' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.backtrace-1' class="method"><span id='backtrace.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.backtrace' class='fnname'>backtrace</a>(&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;&amp;<a class="struct" href="../failure/struct.Backtrace.html" title="struct failure::Backtrace">Backtrace</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/lib.rs.html#263-265' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><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.Fail.html#method.context' class='fnname'>context</a>&lt;D&gt;(self, context: D) -&gt; <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&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,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/lib.rs.html#143-149' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><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.Fail.html#method.compat' class='fnname'>compat</a>(self) -&gt; <a class="struct" href="../failure/struct.Compat.html" title="struct failure::Compat">Compat</a>&lt;Self&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/failure/lib.rs.html#156-161' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span>
  98. <h2 id='implementors' class='small-section-header'>
  99. Implementors<a href='#implementors' class='anchor'></a>
  100. </h2>
  101. <ul class='item-list' id='implementors-list'>
  102. <li><table class='table-display'><tbody><tr><td><code>impl&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; Fail for <a class="struct" href="../failure/struct.Context.html" title="struct failure::Context">Context</a>&lt;D&gt;</code><td><div class='out-of-band'><a class='srclink' href='../src/failure/context.rs.html#83-91' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
  103. <li><table class='table-display'><tbody><tr><td><code>impl&lt;E:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</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; Fail for <a class="struct" href="../failure/struct.SyncFailure.html" title="struct failure::SyncFailure">SyncFailure</a>&lt;E&gt;</code><td><div class='out-of-band'><a class='srclink' href='../src/failure/sync_failure.rs.html#97' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
  104. <li><table class='table-display'><tbody><tr><td><code>impl&lt;E:&nbsp;<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.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; Fail for E</code><td><div class='out-of-band'><a class='srclink' href='../src/failure/lib.rs.html#255' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
  105. </ul><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
  106. src="../implementors/failure/trait.Fail.js">
  107. </script></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>