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