Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (34 sloc) 847 Bytes

Error

When deriving for enum like the following:

#[enum_derive(Error)]
enum Enum<A, B> {
    A(A),
    B(B),
}

Code like this will be generated:

enum Enum<A, B> {
    A(A),
    B(B),
}

impl<A, B> ::std::error::Error for Enum<A, B>
where
    A: ::std::error::Error + 'static,
    B: ::std::error::Error + 'static,
{
    fn description(&self) -> &str {
        match self {
            Enum::A(x) => ::std::error::Error::description(x),
            Enum::B(x) => ::std::error::Error::description(x),
        }
    }
    fn source(&self) -> ::std::option::Option<&(dyn (::std::error::Error) + 'static)> {
        match self {
            Enum::A(x) => ::std::option::Option::Some(x),
            Enum::B(x) => ::std::option::Option::Some(x),
        }
    }
}
You can’t perform that action at this time.