rs42

Macro error_struct_custom_display

Source
macro_rules! error_struct_custom_display {
    ($struct_name:ident $( { $( $field_name:ident : $field_type:ty ),* $(,)? } )?,
     $format_message:expr $(, $( $format_var:ident ), * $(,)? )?) => { ... };
}
Expand description

Facilitates the creation of error structures with a custom display message

ยงExample

use rs42::error_struct_custom_display;

error_struct_custom_display!(
    ErrorStructName,
    "Error msg",
);

error_struct_custom_display!(
    OtherErrorStructName {
        data: u32,
    },
    "Error msg {}", data
);