Crate cdumay_error_derive

Crate cdumay_error_derive 

Source
Expand description

License: BSD-3-Clause cdumay_error_derive on crates.io cdumay_error_derive on docs.rs Source Code Repository

The cdumay_error_derive crate provides procedural macros to simplify the creation of custom error types in Rust. By leveraging these macros, developers can efficiently define error structures that integrate seamlessly with the cdumay_error error management ecosystem.

§Overview

Error handling in Rust often involves creating complex structs to represent various error kinds and implementing traits to provide context and conversions. The cdumay_error_derive crate automates this process by offering macros that generate the necessary boilerplate code, allowing for more readable and maintainable error definitions.

§Features

  • Macros: Automatically generate implementations for custom error types.
  • Integration with cdumay_error: Designed to work cohesively with the cdumay_error crate, ensuring consistent error handling patterns.

§Usage

See cdumay_error documentation for more information.

Macros§

define_errors
The define_errors macro is a procedural macro that generates structured error types implementing cdumay_error::AsError. This macro simplifies error handling by defining error structures with relevant metadata, serialization, and error conversion logic.
define_kinds
The define_kinds macro is a procedural macro that generates constants of type cdumay_error::ErrorKind. This macro simplifies the definition of structured error kinds by allowing developers to declare them using a concise syntax. It takes a list of error definitions and expands them into properly structured cdumay_error::ErrorKind constants.