<!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` trait in crate `std`."> <meta name="keywords" content="rust, rustlang, rust-lang, Error"> <title>std::error::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="../../main.css" id="themeStyle"> <script src="../../storage.js"></script> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </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">☰</div> <a href='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a> <p class='location'>Trait Error</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.description">description</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.cause">cause</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Error">TryFromSliceError</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.is">is</a><a href="#method.downcast_ref">downcast_ref</a><a href="#method.downcast_mut">downcast_mut</a><a href="#method.is">is</a><a href="#method.downcast_ref">downcast_ref</a><a href="#method.downcast_mut">downcast_mut</a><a href="#method.is">is</a><a href="#method.downcast_ref">downcast_ref</a><a href="#method.downcast_mut">downcast_mut</a><a href="#method.downcast">downcast</a><a href="#method.downcast">downcast</a><a href="#method.downcast">downcast</a></div></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>error</a></p><script>window.sidebarCurrent = {name: 'Error', 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"> </div> </form> </nav> <section id='main' class="content"> <h1 class='fqn'><span class='in-band'>Trait <a href='../index.html'>std</a>::<wbr><a href='index.html'>error</a>::<wbr><a class="trait" href=''>Error</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><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/std/error.rs.html#69-164' title='goto source code'>[src]</a></span></h1> <pre class='rust trait'>pub trait Error: <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a> + <a class="trait" href="../../std/fmt/trait.Display.html" title="trait std::fmt::Display">Display</a> { fn <a href='#tymethod.description' class='fnname'>description</a>(&self) -> &<a class="primitive" href="../primitive.str.html">str</a>; fn <a href='#method.cause' class='fnname'>cause</a>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><&<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>> { ... } }</pre><div class='docblock'><p>Base functionality for all errors in Rust.</p> </div> <h2 id='required-methods' class='small-section-header'> Required Methods<a href='#required-methods' class='anchor'></a> </h2> <div class='methods'> <h3 id='tymethod.description' class='method'><span id='description.v' class='invisible'><code>fn <a href='#tymethod.description' class='fnname'>description</a>(&self) -> &<a class="primitive" href="../primitive.str.html">str</a></code></span></h3><div class='docblock'><p>A short description of the error.</p> <p>The description should only be used for a simple message. It should not contain newlines or sentence-ending punctuation, to facilitate embedding in larger user-facing strings. For showing formatted error messages with more information see <a href="../fmt/trait.Display.html"><code>Display</code></a>.</p> <h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>; <span class="kw">match</span> <span class="string">"xc"</span>.<span class="ident">parse</span>::<span class="op"><</span><span class="ident">u32</span><span class="op">></span>() { <span class="prelude-val">Err</span>(<span class="ident">e</span>) <span class="op">=></span> { <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Error: {}"</span>, <span class="ident">e</span>.<span class="ident">description</span>()); } _ <span class="op">=></span> <span class="macro">println</span><span class="macro">!</span>(<span class="string">"No error"</span>), }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0A%0Amatch%20%22xc%22.parse%3A%3A%3Cu32%3E()%20%7B%0A%20%20%20%20Err(e)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20println!(%22Error%3A%20%7B%7D%22%2C%20e.description())%3B%0A%20%20%20%20%7D%0A%20%20%20%20_%20%3D%3E%20println!(%22No%20error%22)%2C%0A%7D%0A%7D">Run</a></pre> </div></div> <h2 id='provided-methods' class='small-section-header'> Provided Methods<a href='#provided-methods' class='anchor'></a> </h2> <div class='methods'> <h3 id='method.cause' class='method'><span id='cause.v' class='invisible'><code>fn <a href='#method.cause' class='fnname'>cause</a>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><&<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>></code></span></h3><div class='docblock'><p>The lower-level cause of this error, if any.</p> <h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>; <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fmt</span>; <span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>)]</span> <span class="kw">struct</span> <span class="ident">SuperError</span> { <span class="ident">side</span>: <span class="ident">SuperErrorSideKick</span>, } <span class="kw">impl</span> <span class="ident">fmt</span>::<span class="ident">Display</span> <span class="kw">for</span> <span class="ident">SuperError</span> { <span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt</span>::<span class="ident">Formatter</span>) <span class="op">-></span> <span class="ident">fmt</span>::<span class="prelude-ty">Result</span> { <span class="macro">write</span><span class="macro">!</span>(<span class="ident">f</span>, <span class="string">"SuperError is here!"</span>) } } <span class="kw">impl</span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">SuperError</span> { <span class="kw">fn</span> <span class="ident">description</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-></span> <span class="kw-2">&</span><span class="ident">str</span> { <span class="string">"I'm the superhero of errors"</span> } <span class="kw">fn</span> <span class="ident">cause</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">Error</span><span class="op">></span> { <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">side</span>) } } <span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>)]</span> <span class="kw">struct</span> <span class="ident">SuperErrorSideKick</span>; <span class="kw">impl</span> <span class="ident">fmt</span>::<span class="ident">Display</span> <span class="kw">for</span> <span class="ident">SuperErrorSideKick</span> { <span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt</span>::<span class="ident">Formatter</span>) <span class="op">-></span> <span class="ident">fmt</span>::<span class="prelude-ty">Result</span> { <span class="macro">write</span><span class="macro">!</span>(<span class="ident">f</span>, <span class="string">"SuperErrorSideKick is here!"</span>) } } <span class="kw">impl</span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">SuperErrorSideKick</span> { <span class="kw">fn</span> <span class="ident">description</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-></span> <span class="kw-2">&</span><span class="ident">str</span> { <span class="string">"I'm SuperError side kick"</span> } } <span class="kw">fn</span> <span class="ident">get_super_error</span>() <span class="op">-></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">SuperError</span><span class="op">></span> { <span class="prelude-val">Err</span>(<span class="ident">SuperError</span> { <span class="ident">side</span>: <span class="ident">SuperErrorSideKick</span> }) } <span class="kw">fn</span> <span class="ident">main</span>() { <span class="kw">match</span> <span class="ident">get_super_error</span>() { <span class="prelude-val">Err</span>(<span class="ident">e</span>) <span class="op">=></span> { <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Error: {}"</span>, <span class="ident">e</span>.<span class="ident">description</span>()); <span class="macro">println</span><span class="macro">!</span>(<span class="string">"Caused by: {}"</span>, <span class="ident">e</span>.<span class="ident">cause</span>().<span class="ident">unwrap</span>()); } _ <span class="op">=></span> <span class="macro">println</span><span class="macro">!</span>(<span class="string">"No error"</span>), } }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Afmt%3B%0A%0A%23%5Bderive(Debug)%5D%0Astruct%20SuperError%20%7B%0A%20%20%20%20side%3A%20SuperErrorSideKick%2C%0A%7D%0A%0Aimpl%20fmt%3A%3ADisplay%20for%20SuperError%20%7B%0A%20%20%20%20fn%20fmt(%26self%2C%20f%3A%20%26mut%20fmt%3A%3AFormatter)%20-%3E%20fmt%3A%3AResult%20%7B%0A%20%20%20%20%20%20%20%20write!(f%2C%20%22SuperError%20is%20here!%22)%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20Error%20for%20SuperError%20%7B%0A%20%20%20%20fn%20description(%26self)%20-%3E%20%26str%20%7B%0A%20%20%20%20%20%20%20%20%22I'm%20the%20superhero%20of%20errors%22%0A%20%20%20%20%7D%0A%0A%20%20%20%20fn%20cause(%26self)%20-%3E%20Option%3C%26Error%3E%20%7B%0A%20%20%20%20%20%20%20%20Some(%26self.side)%0A%20%20%20%20%7D%0A%7D%0A%0A%23%5Bderive(Debug)%5D%0Astruct%20SuperErrorSideKick%3B%0A%0Aimpl%20fmt%3A%3ADisplay%20for%20SuperErrorSideKick%20%7B%0A%20%20%20%20fn%20fmt(%26self%2C%20f%3A%20%26mut%20fmt%3A%3AFormatter)%20-%3E%20fmt%3A%3AResult%20%7B%0A%20%20%20%20%20%20%20%20write!(f%2C%20%22SuperErrorSideKick%20is%20here!%22)%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20Error%20for%20SuperErrorSideKick%20%7B%0A%20%20%20%20fn%20description(%26self)%20-%3E%20%26str%20%7B%0A%20%20%20%20%20%20%20%20%22I'm%20SuperError%20side%20kick%22%0A%20%20%20%20%7D%0A%7D%0A%0Afn%20get_super_error()%20-%3E%20Result%3C()%2C%20SuperError%3E%20%7B%0A%20%20%20%20Err(SuperError%20%7B%20side%3A%20SuperErrorSideKick%20%7D)%0A%7D%0A%0Afn%20main()%20%7B%0A%20%20%20%20match%20get_super_error()%20%7B%0A%20%20%20%20%20%20%20%20Err(e)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20println!(%22Error%3A%20%7B%7D%22%2C%20e.description())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20println!(%22Caused%20by%3A%20%7B%7D%22%2C%20e.cause().unwrap())%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20_%20%3D%3E%20println!(%22No%20error%22)%2C%0A%20%20%20%20%7D%0A%7D%0A">Run</a></pre> </div></div> <h2 id='methods' class='small-section-header'> Methods<a href='#methods' class='anchor'></a> </h2> <h3 id='impl' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#383-425' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.is' class="method"><span id='is.v' class='invisible'><code>pub fn <a href='#method.is' class='fnname'>is</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#387-396' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Returns true if the boxed type is the same as <code>T</code></p> </div><h4 id='method.downcast_ref' class="method"><span id='downcast_ref.v' class='invisible'><code>pub fn <a href='#method.downcast_ref' class='fnname'>downcast_ref</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="primitive" href="../primitive.reference.html">&</a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#402-410' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Returns some reference to the boxed value if it is of type <code>T</code>, or <code>None</code> if it isn't.</p> </div><h4 id='method.downcast_mut' class="method"><span id='downcast_mut.v' class='invisible'><code>pub fn <a href='#method.downcast_mut' class='fnname'>downcast_mut</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&mut self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="primitive" href="../primitive.reference.html">&mut </a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#416-424' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Returns some mutable reference to the boxed value if it is of type <code>T</code>, or <code>None</code> if it isn't.</p> </div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + 'static</code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#427-448' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.is-1' class="method"><span id='is.v-1' class='invisible'><code>pub fn <a href='#method.is-1' class='fnname'>is</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#431-433' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Forwards to the method defined on the type <code>Any</code>.</p> </div><h4 id='method.downcast_ref-1' class="method"><span id='downcast_ref.v-1' class='invisible'><code>pub fn <a href='#method.downcast_ref-1' class='fnname'>downcast_ref</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="primitive" href="../primitive.reference.html">&</a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#438-440' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Forwards to the method defined on the type <code>Any</code>.</p> </div><h4 id='method.downcast_mut-1' class="method"><span id='downcast_mut.v-1' class='invisible'><code>pub fn <a href='#method.downcast_mut-1' class='fnname'>downcast_mut</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&mut self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="primitive" href="../primitive.reference.html">&mut </a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#445-447' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Forwards to the method defined on the type <code>Any</code>.</p> </div></div><h3 id='impl-2' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'static</code><a href='#impl-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#450-471' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.is-2' class="method"><span id='is.v-2' class='invisible'><code>pub fn <a href='#method.is-2' class='fnname'>is</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#454-456' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Forwards to the method defined on the type <code>Any</code>.</p> </div><h4 id='method.downcast_ref-2' class="method"><span id='downcast_ref.v-2' class='invisible'><code>pub fn <a href='#method.downcast_ref-2' class='fnname'>downcast_ref</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="primitive" href="../primitive.reference.html">&</a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#461-463' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Forwards to the method defined on the type <code>Any</code>.</p> </div><h4 id='method.downcast_mut-2' class="method"><span id='downcast_mut.v-2' class='invisible'><code>pub fn <a href='#method.downcast_mut-2' class='fnname'>downcast_mut</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(&mut self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="primitive" href="../primitive.reference.html">&mut </a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#468-470' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Forwards to the method defined on the type <code>Any</code>.</p> </div></div><h3 id='impl-3' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a></code><a href='#impl-3' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#473-487' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.downcast' class="method"><span id='downcast.v' class='invisible'><code>pub fn <a href='#method.downcast' class='fnname'>downcast</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(<br> self: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><Self><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><T>, <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#477-486' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Attempt to downcast the box to a concrete type.</p> </div></div><h3 id='impl-4' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a></code><a href='#impl-4' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#489-501' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.downcast-1' class="method"><span id='downcast.v-1' class='invisible'><code>pub fn <a href='#method.downcast-1' class='fnname'>downcast</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(<br> self: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><Self><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><T>, <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a>>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#493-500' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Attempt to downcast the box to a concrete type.</p> </div></div><h3 id='impl-5' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a></code><a href='#impl-5' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#503-515' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.downcast-2' class="method"><span id='downcast.v-2' class='invisible'><code>pub fn <a href='#method.downcast-2' class='fnname'>downcast</a><T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static>(<br> self: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><Self><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><T>, <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><Self>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/std/error.rs.html#507-514' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Attempt to downcast the box to a concrete type.</p> </div></div> <h2 id='foreign-impls' class='small-section-header'> Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a> </h2> <h3 id='impl-Error' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="struct" href="../../core/array/struct.TryFromSliceError.html" title="struct core::array::TryFromSliceError">TryFromSliceError</a></code><a href='#impl-Error' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#287-291' title='goto source code'>[src]</a></span></h3> <span class='docblock autohide'><div class='impl-items'><h4 id='method.description' class="method"><span id='description.v-1' class='invisible'><code>fn <a href='#method.description' class='fnname'>description</a>(&self) -> &<a class="primitive" href="../primitive.str.html">str</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/error.rs.html#288-290' title='goto source code'>[src]</a></span></h4> <h4 id='method.cause-1' class="method"><span id='cause.v-1' class='invisible'><code>fn <a href='../../std/error/trait.Error.html#method.cause' class='fnname'>cause</a>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><&<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../../src/std/error.rs.html#154' title='goto source code'>[src]</a></span></h4> </div></span> <h2 id='implementors' class='small-section-header'> Implementors<a href='#implementors' class='anchor'></a> </h2> <ul class='item-list' id='implementors-list'> <li><div class='out-of-band'><a class='srclink' href='../../src/std/env.rs.html#275-282' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/env/enum.VarError.html" title="enum std::env::VarError">VarError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/env.rs.html#498-500' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/env/struct.JoinPathsError.html" title="struct std::env::JoinPathsError">JoinPathsError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#238-240' title='goto source code'>[src]</a></div><code>impl Error for <a class="primitive" href="../primitive.never.html">!</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#245-249' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#254-258' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/heap/struct.CannotReallocInPlace.html" title="struct std::heap::CannotReallocInPlace">CannotReallocInPlace</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#261-263' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/str/struct.ParseBoolError.html" title="struct std::str::ParseBoolError">ParseBoolError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#266-270' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/str/struct.Utf8Error.html" title="struct std::str::Utf8Error">Utf8Error</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#273-277' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/num/struct.ParseIntError.html" title="struct std::num::ParseIntError">ParseIntError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#280-284' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/num/struct.TryFromIntError.html" title="struct std::num::TryFromIntError">TryFromIntError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#294-298' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/num/struct.ParseFloatError.html" title="struct std::num::ParseFloatError">ParseFloatError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#301-305' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/string/struct.FromUtf8Error.html" title="struct std::string::FromUtf8Error">FromUtf8Error</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#308-312' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/string/struct.FromUtf16Error.html" title="struct std::string::FromUtf16Error">FromUtf16Error</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#315-319' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/string/enum.ParseError.html" title="enum std::string::ParseError">ParseError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#322-326' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/char/struct.DecodeUtf16Error.html" title="struct std::char::DecodeUtf16Error">DecodeUtf16Error</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#329-337' title='goto source code'>[src]</a></div><code>impl<T: <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>> Error for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a><T></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#340-344' title='goto source code'>[src]</a></div><code>impl Error for std::fmt::<a class="struct" href="../../std/fmt/struct.Error.html" title="struct std::fmt::Error">Error</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#347-351' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/cell/struct.BorrowError.html" title="struct std::cell::BorrowError">BorrowError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#354-358' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/cell/struct.BorrowMutError.html" title="struct std::cell::BorrowMutError">BorrowMutError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#361-365' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/char/struct.CharTryFromError.html" title="struct std::char::CharTryFromError">CharTryFromError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#368-372' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/char/struct.ParseCharError.html" title="struct std::char::ParseCharError">ParseCharError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/error.rs.html#375-380' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/convert/enum.Infallible.html" title="enum std::convert::Infallible">Infallible</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/ffi/c_str.rs.html#789-791' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/ffi/struct.NulError.html" title="struct std::ffi::NulError">NulError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/ffi/c_str.rs.html#809-818' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/ffi/struct.FromBytesWithNulError.html" title="struct std::ffi::FromBytesWithNulError">FromBytesWithNulError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/ffi/c_str.rs.html#849-857' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/ffi/struct.IntoStringError.html" title="struct std::ffi::IntoStringError">IntoStringError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/io/buffered.rs.html#664-668' title='goto source code'>[src]</a></div><code>impl<W: <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a>> Error for <a class="struct" href="../../std/io/struct.IntoInnerError.html" title="struct std::io::IntoInnerError">IntoInnerError</a><W></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/io/error.rs.html#546-561' title='goto source code'>[src]</a></div><code>impl Error for std::io::<a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/io/mod.rs.html#2058-2071' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/io/enum.CharsError.html" title="enum std::io::CharsError">CharsError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/net/parser.rs.html#394-398' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/net/struct.AddrParseError.html" title="struct std::net::AddrParseError">AddrParseError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/path.rs.html#2616-2618' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/path/struct.StripPrefixError.html" title="struct std::path::StripPrefixError">StripPrefixError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1636-1644' title='goto source code'>[src]</a></div><code>impl<T: <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a>> Error for <a class="struct" href="../../std/sync/mpsc/struct.SendError.html" title="struct std::sync::mpsc::SendError">SendError</a><T></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1671-1687' title='goto source code'>[src]</a></div><code>impl<T: <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a>> Error for <a class="enum" href="../../std/sync/mpsc/enum.TrySendError.html" title="enum std::sync::mpsc::TrySendError">TrySendError</a><T></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1706-1715' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/sync/mpsc/struct.RecvError.html" title="struct std::sync::mpsc::RecvError">RecvError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1732-1748' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/sync/mpsc/enum.TryRecvError.html" title="enum std::sync::mpsc::TryRecvError">TryRecvError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1774-1789' title='goto source code'>[src]</a></div><code>impl Error for <a class="enum" href="../../std/sync/mpsc/enum.RecvTimeoutError.html" title="enum std::sync::mpsc::RecvTimeoutError">RecvTimeoutError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/time.rs.html#430-432' title='goto source code'>[src]</a></div><code>impl Error for <a class="struct" href="../../std/time/struct.SystemTimeError.html" title="struct std::time::SystemTimeError">SystemTimeError</a></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sys_common/poison.rs.html#162-166' title='goto source code'>[src]</a></div><code>impl<T> Error for <a class="struct" href="../../std/sync/struct.PoisonError.html" title="struct std::sync::PoisonError">PoisonError</a><T></code></li> <li><div class='out-of-band'><a class='srclink' href='../../src/std/sys_common/poison.rs.html#246-260' title='goto source code'>[src]</a></div><code>impl<T> Error for <a class="enum" href="../../std/sync/enum.TryLockError.html" title="enum std::sync::TryLockError">TryLockError</a><T></code></li> </ul><script type="text/javascript" async src="../../implementors/std/error/trait.Error.js"> </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>⏎</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> </div> </div> </aside> <script> window.rootPath = "../../"; window.currentCrate = "std"; </script> <script src="../../main.js"></script> <script defer src="../../search-index.js"></script> </body> </html>