Bytenum is a rust derive macro that creates a try_from
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
enum TestEnum { Red, Green, Blue, }
fn checkenum() -> Result<(), Box
```