Derive Macro enumcapsulate_macros::IsVariant

source ·
#[derive(IsVariant)]
Expand description

Derive macro generating an impl of the trait IsVariant.

The generated impl looks something along these lines:

struct Inner;

enum Outer {
    Inner(Inner),
    // ...
}

// The generated impls look something along these lines:

impl IsVariant for Outer {
    fn is_variant<T>(&self) -> bool
    where
        T: 'static + ?Sized
    {
        match self {
           Outer::Inner(inner) => /* ... */,
           // ...
       }
    }
}

// ...