Attribute Macro utility_types::exclude[][src]

#[exclude]
Expand description

Constructs an enum by excluding variants in the set from the original enum.

Example

#[exclude(Terra, [Jupiter, Saturn, Uranus, Neptune], [Debug])]
enum Planet<T> {
    Mercury(T),
    Venus(T),
    Earth(T),
    Mars(T),
    Jupiter(T),
    Saturn(T),
    Uranus(T),
    Neptune(T),
}

The code above will become this:

enum Planet<T> {
    Mercury(T),
    Venus(T),
    Earth(T),
    Mars(T),
    Jupiter(T),
    Saturn(T),
    Uranus(T),
    Neptune(T),
}

#[derive(Debug)]
enum Terra<T> {
    Mercury(T),
    Venus(T),
    Earth(T),
    Mars(T),
}

Notice

Currently, generics are not analyzed. So rustc will complain if the field with generic is not included in the generated enum.