numeric-enum-macro

A declarative macro for type-safe enum-to-numbers conversion. no-std supported!

```rust use numericenummacro::numeric_enum;

numericenum! { #[repr(i64)] // repr must go first. /// Some docs. /// /// Multiline docs works too. #[derive(Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] // all the attributes are forwarded! pub enum Lol { // All the constants must have explicit values assigned! Kek = 14, Wow = 87, } } // Conversion to raw number: asserteq!(14i64, Lol::Kek.into()); // Conversion from raw number: asserteq!(Ok(Lol::Wow), Lol::tryfrom(87)); // Unknown number: asserteq!(Err(88), Lol::tryfrom(88)); ```

License: MIT/Apache-2.0