the <ahref="https://doc.rust-lang.org/1.80.0/core/error/trait.Error.html"title="trait core::error::Error"><code>std::error::Error</code></a> trait.</p>
.with_context(|| <spanclass="macro">format!</span>(<spanclass="string">"Failed to read instrs from {}"</span>, path))<spanclass="question-mark">?</span>;
...
}</code></pre></div>
<divclass="example-wrap"><preclass="language-console"><code>Error: Failed to read instrs from ./path/to/instrs.json
Caused by:
No such file or directory (os error 2)
</code></pre></div></li>
<li>
<p>Downcasting is supported and can be by value, by shared reference, or by
mutable reference as needed.</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="comment">// If the error was caused by redaction, then return a
</div></details><h2id="reexports"class="section-header">Re-exports<ahref="#reexports"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"id="reexport.format_err"><code>pub use <aclass="macro"href="macro.anyhow.html"title="macro anyhow::anyhow">anyhow</a> as format_err;</code></div></li></ul><h2id="macros"class="section-header">Macros<ahref="#macros"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="macro"href="macro.anyhow.html"title="macro anyhow::anyhow">anyhow</a></div><divclass="desc docblock-short">Construct an ad-hoc error from a string or existing non-<code>anyhow</code> error
value.</div></li><li><divclass="item-name"><aclass="macro"href="macro.bail.html"title="macro anyhow::bail">bail</a></div><divclass="desc docblock-short">Return early with an error.</div></li><li><divclass="item-name"><aclass="macro"href="macro.ensure.html"title="macro anyhow::ensure">ensure</a></div><divclass="desc docblock-short">Return early with an error if a condition is not satisfied.</div></li></ul><h2id="structs"class="section-header">Structs<ahref="#structs"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="struct"href="struct.Chain.html"title="struct anyhow::Chain">Chain</a></div><divclass="desc docblock-short">Iterator of a chain of source errors.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Error.html"title="struct anyhow::Error">Error</a></div><divclass="desc docblock-short">The <code>Error</code> type, a wrapper around a dynamic error type.</div></li></ul><h2id="traits"class="section-header">Traits<ahref="#traits"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="trait"href="trait.Context.html"title="trait anyhow::Context">Context</a></div><divclass="desc docblock-short">Provides the <code>context</code> method for <code>Result</code>.</div></li></ul><h2id="functions"class="section-header">Functions<ahref="#functions"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="fn"href="fn.Ok.html"title="fn anyhow::Ok">Ok</a></div><divclass="desc docblock-short">Equivalent to Ok::<_, anyhow::Error>(value).</div></li></ul><h2id="types"class="section-header">Type Aliases<ahref="#types"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="type"href="type.Result.html"title="type anyhow::Result">Result</a></div><divclass="desc docblock-short"><code>Result<T, Error></code></div></li></ul></section></div></main></body></html>