This will not work on anything more complicated than the simple text-only string used in the example, as selectors and placeables are not yet handled.
3C3CHSY5FETUIE7W2VQ5V62GJNE3MW2WUM7GJDUFWSDB4WKNFR2AC
}
impl<'resource> GroupEntry<'resource> {
fn to_syn(&self) -> syn::Expr {
match self {
Self::Message(message) => message.value.as_ref().map_or_else(
|| parse_quote! { () },
|pattern| {
let parsed_patterns = pattern.elements.iter().map(match_pattern_element);
parse_quote! { #(#parsed_patterns)+* }
},
),
}
}
fn match_pattern_element<'resource>(
pattern_element: &'resource PatternElement<&'resource str>,
) -> syn::Expr {
match pattern_element {
PatternElement::TextElement { value } => parse_quote! { #value },
_ => todo!(),
}
}