Macro variter::foreign_derive_var_iter[][src]

macro_rules! foreign_derive_var_iter {
    (
        $(@impl_attr {
            $(#[$impl_attr:meta])+
        })?
        $type:ty [] $($rest:tt)*
    ) => { ... };
    (
        $(@impl_attr {
            $(#[$impl_attr:meta])+
        })?
        $type:ty [$($cases:expr),+ $(,)?] $($rest:tt)*
    ) => { ... };
    () => { ... };
}

Automatically derive VarIter for foreign field-less enums. Be sure to include all variants and that the enum is not marked with #[non_exhaustive].

Syntax

foreign_derive_var_iter! {
    Typename [] // enum has no variants
    Typename [Typename::Variant1, Typename::variant2, ... ] // trailing comma supported
    ...
}

You may optionally pass attributes to the impl block by prefixing your type definition with @impl_attr { ATTR... }, for example @impl_attr { #[doc(hidden)] #[cfg(test)] ... }.