svd2rust
svd2rust copied to clipboard
Add try_from for enum variants
As From<enumVariant> for u8 is implemented in https://github.com/rust-embedded/svd2rust/pull/374.
What do you think about implementing TryFrom<u8> for enumVariant?
It could look something like this, in the generated code.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b703f510723d792edcd2776942cc02c7
Not sure is this really required, but:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2134ed8c3cfe52076f7d6220a5f093a1