add-macro-impl-error 0.1.0

Implementation of trait 'Error'
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fmt;

pub type Result<T> = std::result::Result<T, Error>;

#[derive(Debug)]
pub enum Error {
    ImplementationError,
    ExpectedNamedFields,
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match &self {
            Self::ImplementationError => write!(f, "Implementation of trait 'Display' can be derived for Struct's and Enum's only!"),
            Self::ExpectedNamedFields => write!(f, "Expected a named fields in a structure"),
        }
    }
}