Bytenum

Bytenum is a rust derive macro that creates a try_from implementation for an enum with unit variants.

Usage

Add this to your Cargo.toml:

toml bytenum = "0.1.0"

And then add then add a derive Bytenum attribute on an enum that has less than 256 variants (the amount that can be represented by a u8).

```rust

[derive(Bytenum, Debug, PartialEq)]

enum TestEnum { Red, Green, Blue, }

fn checkenum() -> Result<(), Box> { [Color::Red, Color::Green, Color::Blue] .intoiter() .enumerate() .tryforeach(|(index, color)| { asserteq!(color, Color::tryfrom(index as u8)?); Ok(()) }) }

```