Skip to content

Commit d02a264

Browse files
committed
Deploying to gh-pages from @ ef053e2 🚀
1 parent ef9ab90 commit d02a264

2,284 files changed

Lines changed: 251372 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

v0.15.1-nightly-2026-05-01/.lock

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="anyhow" data-themes="" data-resource-suffix="" data-rustdoc-version="1.97.0-nightly (f53b654a8 2026-04-30)" data-channel="nightly" data-search-js="search-b5634cc7.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../static.files/storage-41dd4d93.js"></script><script defer src="../static.files/main-aa4d37ac.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod sys"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">All</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../anyhow/index.html">anyhow</a><span class="version">1.0.102</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#macros">Crate Items</a></h3><ul class="block"><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><h1>List of all items</h1><rustdoc-toolbar></rustdoc-toolbar></div><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.Chain.html">Chain</a></li><li><a href="struct.Error.html">Error</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.Context.html">Context</a></li></ul><h3 id="macros">Macros</h3><ul class="all-items"><li><a href="macro.anyhow.html">anyhow</a></li><li><a href="macro.bail.html">bail</a></li><li><a href="macro.ensure.html">ensure</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.Ok.html">Ok</a></li></ul><h3 id="types">Type Aliases</h3><ul class="all-items"><li><a href="type.Result.html">Result</a></li></ul></section></div></main></body></html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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="Equivalent to `Ok::&#60;_, anyhow::Error&#62;(value)`."><title>Ok in anyhow - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="anyhow" data-themes="" data-resource-suffix="" data-rustdoc-version="1.97.0-nightly (f53b654a8 2026-04-30)" data-channel="nightly" data-search-js="search-b5634cc7.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../static.files/storage-41dd4d93.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-aa4d37ac.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Ok</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../anyhow/index.html">anyhow</a><span class="version">1.0.102</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">anyhow</a></div><h1>Function <span class="fn">Ok</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/anyhow/lib.rs.html#650-652">Source</a> </span></div><pre class="rust item-decl"><code>pub fn Ok&lt;T&gt;(value: T) -&gt; <a class="type" href="type.Result.html" title="type anyhow::Result">Result</a>&lt;T&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Equivalent to <code>Ok::&lt;_, anyhow::Error&gt;(value)</code>.</p>
2+
<p>This simplifies creation of an <code>anyhow::Result</code> in places where type
3+
inference cannot deduce the <code>E</code> type of the result — without needing
4+
to write <code>Ok::&lt;_, anyhow::Error&gt;(value)</code>.</p>
5+
<p>One might think that <code>anyhow::Result::Ok(value)</code> would work in such cases
6+
but it does not.</p>
7+
<div class="example-wrap"><pre class="language-console"><code>error[E0282]: type annotations needed for `std::result::Result&lt;i32, E&gt;`
8+
--&gt; src/main.rs:11:13
9+
|
10+
11 | let _ = anyhow::Result::Ok(1);
11+
| - ^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `E` declared on the enum `Result`
12+
| |
13+
| consider giving this pattern the explicit type `std::result::Result&lt;i32, E&gt;`, where the type parameter `E` is specified</code></pre></div></div></details></section></div></main></body></html>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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="github crates-io docs-rs"><title>anyhow - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="anyhow" data-themes="" data-resource-suffix="" data-rustdoc-version="1.97.0-nightly (f53b654a8 2026-04-30)" data-channel="nightly" data-search-js="search-b5634cc7.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../static.files/storage-41dd4d93.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-aa4d37ac.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate anyhow</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../anyhow/index.html">anyhow</a><span class="version">1.0.102</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#details" title="Details">Details</a></li><li><a href="#no-std-support" title="No-std support">No-std support</a></li></ul><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><h1>Crate <span>anyhow</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/anyhow/lib.rs.html#1-728">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><a href="https://github.com/dtolnay/anyhow"><img src="https://img.shields.io/badge/github-8da0cb?style=for-the-badge&amp;labelColor=555555&amp;logo=github" alt="github" /></a><a href="https://crates.io/crates/anyhow"><img src="https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&amp;labelColor=555555&amp;logo=rust" alt="crates-io" /></a><a href="https://docs.rs/anyhow"><img src="https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&amp;labelColor=555555&amp;logo=docs.rs" alt="docs-rs" /></a></p>
2+
<br>
3+
<p>This library provides <a href="struct.Error.html" title="struct anyhow::Error"><code>anyhow::Error</code></a>, a trait object based error
4+
type for easy idiomatic error handling in Rust applications.</p>
5+
<br>
6+
<h2 id="details"><a class="doc-anchor" href="#details">§</a>Details</h2>
7+
<ul>
8+
<li>
9+
<p>Use <code>Result&lt;T, anyhow::Error&gt;</code>, or equivalently <code>anyhow::Result&lt;T&gt;</code>, as
10+
the return type of any fallible function.</p>
11+
<p>Within the function, use <code>?</code> to easily propagate any error that implements
12+
the <a href="https://doc.rust-lang.org/nightly/core/error/trait.Error.html" title="trait core::error::Error"><code>std::error::Error</code></a> trait.</p>
13+
14+
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
15+
16+
<span class="kw">fn </span>get_cluster_info() -&gt; <span class="prelude-ty">Result</span>&lt;ClusterMap&gt; {
17+
<span class="kw">let </span>config = std::fs::read_to_string(<span class="string">"cluster.json"</span>)<span class="question-mark">?</span>;
18+
<span class="kw">let </span>map: ClusterMap = serde_json::from_str(<span class="kw-2">&amp;</span>config)<span class="question-mark">?</span>;
19+
<span class="prelude-val">Ok</span>(map)
20+
}</code></pre></div></li>
21+
<li>
22+
<p>Attach context to help the person troubleshooting the error understand
23+
where things went wrong. A low-level error like “No such file or
24+
directory” can be annoying to debug without more context about what higher
25+
level step the application was in the middle of.</p>
26+
27+
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::{Context, <span class="prelude-ty">Result</span>};
28+
29+
<span class="kw">fn </span>main() -&gt; <span class="prelude-ty">Result</span>&lt;()&gt; {
30+
...
31+
it.detach().context(<span class="string">"Failed to detach the important thing"</span>)<span class="question-mark">?</span>;
32+
33+
<span class="kw">let </span>content = std::fs::read(path)
34+
.with_context(|| <span class="macro">format!</span>(<span class="string">"Failed to read instrs from {}"</span>, path))<span class="question-mark">?</span>;
35+
...
36+
}</code></pre></div><div class="example-wrap"><pre class="language-console"><code>Error: Failed to read instrs from ./path/to/instrs.json
37+
38+
Caused by:
39+
No such file or directory (os error 2)</code></pre></div></li>
40+
<li>
41+
<p>Downcasting is supported and can be by value, by shared reference, or by
42+
mutable reference as needed.</p>
43+
44+
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// If the error was caused by redaction, then return a
45+
// tombstone instead of the content.
46+
</span><span class="kw">match </span>root_cause.downcast_ref::&lt;DataStoreError&gt;() {
47+
<span class="prelude-val">Some</span>(DataStoreError::Censored(<span class="kw">_</span>)) =&gt; <span class="prelude-val">Ok</span>(Poll::Ready(REDACTED_CONTENT)),
48+
<span class="prelude-val">None </span>=&gt; <span class="prelude-val">Err</span>(error),
49+
}</code></pre></div></li>
50+
<li>
51+
<p>If using Rust ≥ 1.65, a backtrace is captured and printed with the
52+
error if the underlying error type does not already provide its own. In
53+
order to see backtraces, they must be enabled through the environment
54+
variables described in <a href="https://doc.rust-lang.org/nightly/std/backtrace/index.html#environment-variables" title="mod std::backtrace"><code>std::backtrace</code></a>:</p>
55+
<ul>
56+
<li>If you want panics and errors to both have backtraces, set
57+
<code>RUST_BACKTRACE=1</code>;</li>
58+
<li>If you want only errors to have backtraces, set <code>RUST_LIB_BACKTRACE=1</code>;</li>
59+
<li>If you want only panics to have backtraces, set <code>RUST_BACKTRACE=1</code> and
60+
<code>RUST_LIB_BACKTRACE=0</code>.</li>
61+
</ul>
62+
</li>
63+
<li>
64+
<p>Anyhow works with any error type that has an impl of <code>std::error::Error</code>,
65+
including ones defined in your crate. We do not bundle a <code>derive(Error)</code>
66+
macro but you can write the impls yourself or use a standalone macro like
67+
<a href="https://github.com/dtolnay/thiserror">thiserror</a>.</p>
68+
69+
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>thiserror::Error;
70+
71+
<span class="attr">#[derive(Error, Debug)]
72+
</span><span class="kw">pub enum </span>FormatError {
73+
<span class="attr">#[error(<span class="string">"Invalid header (expected {expected:?}, got {found:?})"</span>)]
74+
</span>InvalidHeader {
75+
expected: String,
76+
found: String,
77+
},
78+
<span class="attr">#[error(<span class="string">"Missing attribute: {0}"</span>)]
79+
</span>MissingAttribute(String),
80+
}</code></pre></div></li>
81+
<li>
82+
<p>One-off error messages can be constructed using the <code>anyhow!</code> macro, which
83+
supports string interpolation and produces an <code>anyhow::Error</code>.</p>
84+
85+
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">return </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Missing attribute: {}"</span>, missing));</code></pre></div>
86+
<p>A <code>bail!</code> macro is provided as a shorthand for the same early return.</p>
87+
88+
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">bail!</span>(<span class="string">"Missing attribute: {}"</span>, missing);</code></pre></div></li>
89+
</ul>
90+
<br>
91+
<h2 id="no-std-support"><a class="doc-anchor" href="#no-std-support">§</a>No-std support</h2>
92+
<p>In no_std mode, almost all of the same API is available and works the same
93+
way. To depend on Anyhow in no_std mode, disable our default enabled “std”
94+
feature in Cargo.toml. A global allocator is required.</p>
95+
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
96+
anyhow = { version = &quot;1.0&quot;, default-features = false }</code></pre></div>
97+
<p>With versions of Rust older than 1.81, no_std mode may require an additional
98+
<code>.map_err(Error::msg)</code> when working with a non-Anyhow error type inside a
99+
function that returns Anyhow’s error type, as the trait that <code>?</code>-based error
100+
conversions are defined by is only available in std in those old versions.</p>
101+
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.format_err"><code>pub use <a class="macro" href="macro.anyhow.html" title="macro anyhow::anyhow">anyhow</a> as format_err;</code></dt></dl><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><dl class="item-table"><dt><a class="macro" href="macro.anyhow.html" title="macro anyhow::anyhow">anyhow</a></dt><dd>Construct an ad-hoc error from a string or existing non-<code>anyhow</code> error
102+
value.</dd><dt><a class="macro" href="macro.bail.html" title="macro anyhow::bail">bail</a></dt><dd>Return early with an error.</dd><dt><a class="macro" href="macro.ensure.html" title="macro anyhow::ensure">ensure</a></dt><dd>Return early with an error if a condition is not satisfied.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Chain.html" title="struct anyhow::Chain">Chain</a></dt><dd>Iterator of a chain of source errors.</dd><dt><a class="struct" href="struct.Error.html" title="struct anyhow::Error">Error</a></dt><dd>The <code>Error</code> type, a wrapper around a dynamic error type.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Context.html" title="trait anyhow::Context">Context</a></dt><dd>Provides the <code>context</code> method for <code>Result</code>.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.Ok.html" title="fn anyhow::Ok">Ok</a></dt><dd>Equivalent to <code>Ok::&lt;_, anyhow::Error&gt;(value)</code>.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.Result.html" title="type anyhow::Result">Result</a></dt><dd><code>Result&lt;T, Error&gt;</code></dd></dl></section></div></main></body></html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta http-equiv="refresh" content="0;URL=macro.anyhow.html">
5+
<title>Redirection</title>
6+
</head>
7+
<body>
8+
<p>Redirecting to <a href="macro.anyhow.html">macro.anyhow.html</a>...</p>
9+
<script>location.replace("macro.anyhow.html" + location.search + location.hash);</script>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)