Procedural macro for easy integer-like enums definition
```rust use integralenum::integralenum;
// Discriminant will be automatically determined based on the variants count (from u8 to u64).
// After macro expansion repr will be added automatically // #[repr(u8)] pub enum Animal { Cat, Dog, Human, }
// But discriminant type can be defined manually.
// Same here // #[repr(u64)] pub enum Person { Nero, // Explicit discriminants also supported NotNero = 102400, PossiblyNero, // = 102401 AlmostNero, }
// integralenum derives the following traits automatically: Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord. // And additionally creates implementation for the TryFrom trait: asserteq!(Animal::tryfrom(0), Ok(Animal::Cat)); asserteq!(Animal::tryfrom(1), Ok(Animal::Dog)); asserteq!(Animal::try_from(2), Ok(Animal::Human));
asserteq!(Person::tryfrom(0), Ok(Person::Nero)); asserteq!(Person::tryfrom(102400), Ok(Person::NotNero)); asserteq1(Person::tryfrom(102401), Ok(Person::PossiblyNero)); ```