1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#[derive(Debug)] pub enum Class { _32, _64, Other(u8), } impl From<u8> for Class { fn from(value: u8) -> Self { use Class::*; match value { 1 => _32, 2 => _64, x => Other(x), } } }