Currently does not handle structs/unions, and does not handle any data contained by the variant fields.
K4XW4OBW5VWRCQZJNVV624E25SKRJPZ5WUXWVYHP6U7T7NPJFMFQC
56F2YE6HUZ76U4QBPUDJ2VQLJ75TQYNTVQIOX4QBOZ2H6GJKRGUQC
UOMQT7LTURIIWHZT2ZHLCJG6XESYTN26EJC7IHRFR4PYJ355PNYAC
BMUMO42ICN3GQW77KUE2GTJPOA77SFDXJ4NNDO5NA2VJS267OXZAC
O77KA6C4UJGZXVGPEA7WCRQH6XYQJPWETSPDXI3VOKOSRQND7JEQC
3C3CHSY5FETUIE7W2VQ5V62GJNE3MW2WUM7GJDUFWSDB4WKNFR2AC
MIHGKLMEPO5O6KSXEBOLEPWGUUL3YBNKJC75G34J23EM55BDX2XQC
// TODO: turn this into a well-formed `match` expression
pub fn to_syn(&self) -> Vec<syn::Expr> {
self.children
.iter()
.map(GroupEntry::to_syn)
.collect::<Vec<_>>()
for variant in enum_data.variants {
let kebab_case_ident = variant.ident.to_string().to_kebab_case();
let message = self
.children
.iter()
.find(|child| child.id() == kebab_case_ident)
.unwrap();
idents.push(variant.ident);
messages.push(message.to_syn());
}
quote! {
impl #ident {
fn localize(&self) -> String {
match self {
#(Self::#idents => #messages),*
}
}
}
}