Mabe
Mabe is a Rust library that provides a derive macro (Mabe) for creating simple and well-structured error enums for easy
debugging. Each variant in the enum can have an error, reason, and solution message. This allows for a more detailed error
handling and debugging process. Also, when an error is printed, the error, reason, and solution messages are displayed in a
structured and colorized format for better readability.
Getting Started
Add the following dependency to your Cargo.toml file:
[]
= "0.2"
You can now use the Mabe derive macro and its attributes to create your own error enums as shown in the example below:
use Mabe;
You can also interpolate the values of variant fields in the error, reason, and solution messages as shown below:
use Mabe;
The Mabe derive macro is quite resilient, as a compile error will only occur if one of the following rules is violated:
- The element on which
Mabeis used must be an enum. - The enum must have at least one variant.
- Each attribute must have exactly one argument of type
&str(string literal). - Each variant field must be interpolated in at least one of the attribute messages of the variant.
Contributing
This project is open to contributions and suggestions, and any help or feedback is highly appreciated. There is no code of conduct, but please be respectful and considerate when engaging with the community.
The project follows the Koseka Contribution Guidelines (Version 1.0) which provides standardized rules and guidelines for contributing to projects, so make sure to read this first before contributing to the project in any way. Additionally, you can also read the DEVELOPMENT.md file for more information on how the project is structured and what you can do to help.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, shall be licensed as bellow, without any additional terms or conditions.
License
Copyright 2024 Amon Rayfa.
This project is licensed under the Apache License (Version 2.0).