I know using match ensures that all values of an enum are handled, but what about when an enum is #[repr()]?
I can think of two situations:
The as overflow, when some values would cause an overflow in the conversion. All values must translate to the given type. If there is a value 256 then as u8 should fail.
The array index, when an array is indexed by enum as usize. The array(not slice) must be large enough to be indexed by every enum value.
I looked for enum size/max value to use for an array size, but then I remembered that rust is more about failing to compile VS auto detection. I still couldn't find anything about these two requirements.