implement_in_error_in_struct

Macro implement_in_error_in_struct 

Source
macro_rules! implement_in_error_in_struct {
    ($struct_error:ident, $err_type: path, $kind: path) => { ... };
}
Expand description

Implement the From trait for an struct with an specific structure.

§Params

implement_in_error_in_struct($struct_error, $err_type, $kind);

§Example

use heimdall_errors::implement_in_error_in_struct;

pub enum ErrorKind{
    IO,
}
pub struct StructError {
    kind: ErrorKind,
    message: String,
    source: Option<Box<dyn std::error::Error>>
}

// Implement From<std::io::Error> for StructError.
implement_in_error_in_struct!(StructError, std::io::Error, ErrorKind::IO);