Macro enum_primitive::enum_from_primitive[][src]

macro_rules! enum_from_primitive {
    ($(#[$enum_attr : meta]) * enum $name : ident
 {
     $($(#[$variant_attr : meta]) * $variant : ident), +
     $(= $discriminator : expr,
       $($(#[$variant_two_attr : meta]) * $variant_two : ident), +) *
 }) => { ... };
    ($(#[$enum_attr : meta]) * enum $name : ident
 {
     $($($(#[$variant_attr : meta]) * $variant : ident), + = $discriminator :
       expr), *
 }) => { ... };
    ($(#[$enum_attr : meta]) * enum $name : ident
 {
     $($(#[$variant_attr : meta]) * $variant : ident), +
     $(= $discriminator : expr,
       $($(#[$variant_two_attr : meta]) * $variant_two : ident), +) *,
 }) => { ... };
    ($(#[$enum_attr : meta]) * enum $name : ident
 {
     $($($(#[$variant_attr : meta]) * $variant : ident), + = $discriminator :
       expr), +,
 }) => { ... };
    ($(#[$enum_attr : meta]) * pub enum $name : ident
 {
     $($(#[$variant_attr : meta]) * $variant : ident), +
     $(= $discriminator : expr,
       $($(#[$variant_two_attr : meta]) * $variant_two : ident), +) *
 }) => { ... };
    ($(#[$enum_attr : meta]) * pub enum $name : ident
 {
     $($($(#[$variant_attr : meta]) * $variant : ident), + = $discriminator :
       expr), *
 }) => { ... };
    ($(#[$enum_attr : meta]) * pub enum $name : ident
 {
     $($(#[$variant_attr : meta]) * $variant : ident), +
     $(= $discriminator : expr,
       $($(#[$variant_two_attr : meta]) * $variant_two : ident), +) *,
 }) => { ... };
    ($(#[$enum_attr : meta]) * pub enum $name : ident
 {
     $($($(#[$variant_attr : meta]) * $variant : ident), + = $discriminator :
       expr), +,
 }) => { ... };
}
Expand description

Wrap this macro around an enum declaration to get an automatically generated implementation of num::FromPrimitive.