提供稳健错误管理、报告和诊断工具的 Rust Crates 合集。
thiserror is a Rust error handling library and procedural macro designed to define custom error types. It functions as a trait implementation automator that generates the necessary code for standard library error traits at compile time. The library focuses on eliminating boilerplate by using derive macros to automatically implement display and source methods. It allows for the creation of custom error structs and enums that can map low-level errors to high-level variants while preserving the original cause and backtrace information. Its capabilities cover custom error formatting through temp
thiserror is a derive-macro library that automates implementing Display, Source, and backtrace for custom error types, providing exactly the ergonomic error creation, chaining, and std::error::Error integration this search requires.
Anyhow is a dynamic error handling library for Rust applications that provides a flexible error container using type erasure. It serves as a tool for simplifying error signatures by wrapping diverse failure types into a single object, allowing for the propagation of any error that implements the standard error trait without requiring a custom enumeration for every function. The project functions as an error context provider by attaching high-level diagnostic information and recording execution stack traces at the point of failure. It enables the recovery of concrete error implementations from
Anyhow is a dynamic error handling library that simplifies error propagation and chaining with context, supports backtraces, and fully integrates with std::error::Error, but it uses type erasure so it does not support defining custom error types — still a core Rust error handling tool that matches your need for ergonomic handling and standard trait integration.