// component.mrs — Vue-like component macro generator // Demonstrates: named literal tokens, variadic binding, $body:tt capture, // escape block using misses_rt, expression injection macro component! { $name:ident { $($prop_name:ident : $prop_type:ty),* } $body:tt => { @{ let struct_name = format_ident!("{}", name.to_string()); } T~{ pub struct $name { for prop in $prop_names => pub $prop_name.name: $prop_name.ty, } impl $name { pub fn new(${ struct_name }( for prop in $prop_names => $prop_name.name: $prop_name.ty, )) -> Self { Self { for prop in $prop_names => $prop_name.name, } } pub fn render(&self) -> misses_rt::Markup { misses_rt::parse_template($body) } } } } }