macro_rules! IterVariants {
    (($itername:ident) $vis:vis enum $name:ident { $($body:tt)* }) => { ... };
    (() $vis:vis enum $name:ident { $($body:tt)* }) => { ... };
}
Expand description

Derives iter_variants() for an unitary enum, which returns an iterator over the variants of the enum in lexical order.

The argument is the name of the iterator type that will be generated:

macro_attr! {
    #[derive(IterVariants!(GetVariants))]
    pub enum Get { Up, Down, AllAround }
}

Neither macro imposes any naming requirements, save the obvious: the name must not conflict with any other types.