Skip to content

Commit

Permalink
Add usage docs for combined_error macro
Browse files Browse the repository at this point in the history
  • Loading branch information
RedPhoenixQ committed Sep 29, 2024
1 parent 60743c6 commit a0ab37f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ use std::sync::Arc;

/// Combines errors into one error enum where `Error::source`, `Display` and `From<SourceError>` is already defined
///
/// **Usage**
/// ```markdown
/// combined_error! {
/// /// ANY DOCS HERE
/// #[ANY_ATTRIBUTE]
/// NAME_OF_ERROR_TYPE ";"
/// ERROR_VARIANT "(" ERROR_TYPE ?STORED_TYPE ")" FORMAT_STRING ","
/// }
/// ```
/// - Docs and attributes are optional and apply to the new error type
/// - FORMAT_STRING: Format string passed directly to `write!` (the error is the only parameter passed to `write!`)
/// - STORED_TYPE: Optional inner type (like Arc<ERROR_TYPE>)
/// - where: ERROR_TYPE: Into<STORED_TYPE>
///
/// Additionally, all source errors are required to have a `Into<crate::Error>`
/// implementation so that all errors can be converted to `crate::Error`
macro_rules! combined_error {
Expand Down

0 comments on commit a0ab37f

Please sign in to comment.