Integral enum

Rust derive-macro that simplifies integral enum creation

Example

```rust use integral_enum::IntegralEnum;

/// Simple meaningful enum /// (!) repr attribute defaults to u8, to specify custom repr /// use built-in attribute #[repr(integral_value)] it /// can contain only integral values /// like u8, u16, u32, u64, u128 and its signed equivalents. /// /// WARNING: if no explicit #[repr(...)] specified u8 will be used /// as the underlying integral type, actual enum still can have u16 representation, /// for example. For most cases this is enough, but if your enum is large /// enough - specify explicit representation. /// FIXME: Add automatic representation determining

[derive(IntegralEnum)]

pub enum Emotion { Pain, Hatred, }

// Test it asserteq!(Emotion::tryfrom(0), Ok(Emotion::Pain)); asserteq!(Emotion::tryfrom(1), Ok(Emotion::Hatred)); asserteq!(Emotion::tryfrom(123), Err(())); ```

Macro will automatically generate the following trait implementations: TryFrom, Clone, Copy, PartialEq, Eq, Display, Debug

if you want to disable certain implementation, consider the #[enum_disable(...)] attribute, items can be: clone, copy, display, debug, total_eq, partial_eq, try_from

Example:

```rust use integral_enum::IntegralEnum;

[derive(IntegralEnum)]

[enum_disable(display)]

pub enum Emotion { Pain, Hatred, }

println!("{}", Emotion::Pain); // Compile error ```

TODO