Expand description
A Rust library of proc-macros for nuhound error tracing
Rust programmers often find the question mark operator invaluable in extracting values from Result and Option and immediately returning to the calling context in the case of an Err or None. This library provides a trio of proc-macros that simplify the use of the nuhound type in error tracing.
With the disclose feature enabled, the error messages contain the line number and column
number of the source file that originated the error. This functionality is provided by the
convert!, examine! and custom! macros. These macros are designed to help simplify error
handling in a concise and consistent Rust style in line with the nuhound paradigm.
These macros require nuhound v0.2 or later.
For a fuller explanation of usage please refer to the nuhound crate v0.2 onwards.
Macrosยง
- convert
- A macro to prepare a
Nuhoundtype error from any error type that implements the Error trait. This also includes Nuhound errors. Resultant errors may be handled using the?operator or by simply returning it to the calling context as aResult::Errdirectly. - custom
- A macro to prepare a
Nuhoundtype error. Whilst theconvertandexaminemacros are designed to respond to previously handled errors, thecustommacro will always generate aNuhounderror without any pre-conditions. Resultant errors may be handled using the?operator or by simply returning it to the calling context as aResult::Errdirectly. Normal usage of this macro would suggest using it inside a condition block and returning the error to the calling context withreturn custom!("My error message");. - examine
- A macro to prepare a
Nuhoundtype error from previously handledNuhounderror(s). Whilst theconvertmacro is completely error type agnostic provided the error handler implements theErrortrait, theexaminemacro requires much less binary code to implement and hence is more efficient. Resultant errors are handled using the?operator by simply returning it to the calling context as aResult::Errdirectly.