3 ms·
> From<u8> and Into<u8> for your type It gets verbose fast when you are talking about all combinations of variants of an enum.
by brigadier132 3y ago
> From<u8> and Into<u8> for your type
It gets verbose fast when you are talking about all combinations of variants of an enum.
- zozbot234 3y agoThe point is that you only have to do it once, when defining the object. Everything else then happens via the From and Into implementations, which the compiler will generally be smart enough to inline. So it'll be just as efficient as working on the underlying u8.
- brigadier132 3y agoYou have to do it once for each subset of variants your state machine requires. Which if you enumerate them all is 2^N from implementations.