Macro custom_error_core::custom_error [−][src]
macro_rules! custom_error { ( $( #[$meta_attribute:meta] )* // Attributes, like #[derive(SomeTrait)] $visibility:vis // `pub` marker $errtype:ident // Name of the error type to generate $( < $( $type_param:tt // Optional type parameters for generic error types ),* > )? $( $( #[$field_meta:meta] )* // Meta-attributes for the variant, such as a doc comment $field:ident // Name of an error variant $( { $( $( #[$attr_meta:meta] )* // Meta-attributes for the attribute of the error variant $attr_name:ident // Name of an attribute of the error variant : $attr_type:ty // type of the attribute ),* } )? = $( @{ $($msg_fun:tt)* } )? $($msg:expr)? // The human-readable error message ),* $(,)* // Trailing comma ) => { ... }; ( $( #[$meta_attribute:meta] )* // Attributes, like #[derive(SomeTrait)] $visibility:vis // `pub` marker $errtype:ident // Name of the error type to generate $( < $( $type_param:tt // Optional type parameters for generic error types ),* > )? { $( $( #[$field_meta:meta] )* // Field meta attributes, such as doc comments $field_name:ident // Name of an attribute of the error variant : $field_type:ty // type of the attribute ),* } = $( @{ $($msg_fun:tt)* } )? $($msg:expr)? // The human-readable error message $(,)* // Trailing comma ) => { ... }; }