pub type IEEE80221ServiceType = u16; <% rows.each do |row| %> pub const <%= row.desc %>: IEEE80221ServiceType = <%= row.value %>; // <%= row.ref %> <% end %> pub fn to_str(a: IEEE80221ServiceType) -> Result<&'static str, ()> { match a { <% rows.each do |row| %> <%= row.value %> => Ok("<%= row.desc %>"), <% end %> _ => Err(()), } }