[][src]Macro enum_derive_2018::IterVariants

macro_rules! IterVariants {
    (($itername:ident) $vis:vis enum $name:ident { $($body:tt)* }) => { ... };
    (
        @expand ($vis:vis) $itername:ident, $name:ident ()
    ) => { ... };
    (
        @expand ($vis:vis) $itername:ident, $name:ident ($($var_names:ident),*)
    ) => { ... };
    (
        @iter ($itername:ident, $name:ident), () -> ($($next_body:tt)*) ($($size_body:tt)*) ($($count:tt)*)
    ) => { ... };
    (
        @iter ($itername:ident, $name:ident), ($a:ident, $b:ident, $($rest:tt)*) -> ($($next_body:tt)*) ($($size_body:tt)*) ($($count:tt)*)
    ) => { ... };
    (
        @iter ($itername:ident, $name:ident), ($a:ident,) -> ($($next_body:tt)*) ($($size_body:tt)*) ($($count:tt)*)
    ) => { ... };
}

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.