anyhow-rust
Installation
SKILL.md
Anyhow Rust
Use these conventions for Rust error handling with dtolnay/anyhow. Anyhow provides anyhow::Error, a trait-object error type that wraps anything implementing std::error::Error, plus ergonomic context, chaining, and downcasting.
Source Baseline
- Prefer released docs from
docs.rs/anyhow, crates.io, and the matching GitHub release over older blog snippets. - Latest 1.x release line. Add to
Cargo.toml:[dependencies] anyhow = "1" - For no-std:
anyhow = { version = "1", default-features = false }. A global allocator is still required.
Application vs Library Split
This is the most important rule. Pick the right tool at the right boundary: