// File: templates/messages.rs.tera // Messages {% for message in messages %} #[derive(Debug, Clone, Serialize, Deserialize)] pub enum {{ message.name|capitalize }} { {% for field in message.fields %} {{ field.name|capitalize }} { {% for subfield in field.fields %} {{ subfield.name }}: {{ subfield.field_type|rust_type }}, {% endfor %} }, {% endfor %} } impl {{ message.name|capitalize }} { pub fn new_{{ field.name|lowercase }}( {% for subfield in field.fields %} {{ subfield.name }}: {{ subfield.field_type|rust_type }}, {% endfor %} ) -> Self { Self::{{ field.name|capitalize }} { {% for subfield in field.fields %} {{ subfield.name }}, {% endfor %} } } } {% endfor %}