Skip to content
Myr

Include example of anyhow! macro

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent c0db224 · Browse files · 2 files+20 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+20 added−0 removed

  • other:+20 added−0 removed

2 files+20 added−0 removed

modified:src/lib.rs+13 added
144 unmodified lines
145//! }146//! # };147//! ```148//!149//! - One-off error messages can be constructed using the `anyhow!` macro, which150//! supports string interpolation and produces an `anyhow::Error`.151//!152//! ```153//! # use anyhow::{anyhow, Result};154//! #155//! # fn demo() -> Result<()> {156//! # let missing = "...";157//! return Err(anyhow!("missing attribute: {}", missing));158//! # Ok(())159//! # }160//! ```161//!162//! <br>163//!164//! # Acknowledgements165//!
75 unmodified lines
modified:README.md+7 added