From a0ab37fdf1beb965aa9b12d0d80e96c86491ef9b Mon Sep 17 00:00:00 2001 From: RedPhoenixQ Date: Sun, 29 Sep 2024 20:39:15 +0200 Subject: [PATCH] Add usage docs for combined_error macro --- src/errors.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/errors.rs b/src/errors.rs index 7786ea70..cd41db58 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -10,6 +10,20 @@ use std::sync::Arc; /// Combines errors into one error enum where `Error::source`, `Display` and `From` 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) +/// - where: ERROR_TYPE: Into +/// /// Additionally, all source errors are required to have a `Into` /// implementation so that all errors can be converted to `crate::Error` macro_rules! combined_error {