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