From a94ee2ac344e3d5b876558eccfab477178c28144 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..1c858844 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** +/// ```no_run +/// 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 {