Registry / utility / err-derive

err-derive

JSON →
library0.3.1rscratesunverified

Derive macro for implementing the `std::error::Error` trait on custom error types.

# Cargo.toml [dependencies] err-derive = "0.3.1"
INSTALL
IMPORT
SIG · ERR-DERIVE
E
err-derive
utilityrustv0.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Error
use err_derive::Error;

Defines a custom error type using the derive macro.

use err_derive::Error; #[derive(Debug, Error)] pub enum MyError { #[error(display = "An IO error occurred: {}", _0)] Io(#[source] std::io::Error), } fn main() { let e = MyError::Io(std::io::Error::new(std::io::ErrorKind::Other, "oh no")); println!("{}", e); }
Debug
Known issues
gotchaRequires Rust edition 2018 or later for proc macros.
fix
Ensure your crate is set to edition 2018 or 2021 in Cargo.toml.
affects: >=0.1.0
Upgrade
Version history
0.3.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
err-derive — cargo add err-derive · libregistry