use loess::quote_into_mixed_site; use proc_macro2::{Span, TokenStream}; fn my_quote(span: Span, root: &TokenStream, output: &mut TokenStream) { quote_into_mixed_site!(span, root, output, { // Emits `b`. {#if false { a } else { b }} // Emits `e`. {#if false { a } else for _ in 0..0 { b } else while let Some(0) = None { c } else match 0 { 1 => { d } _ => { e } }} }); }
Interlaced (procedural) templating can be really nice I think, as long as the syntax is clean and bracket-nesting is strict.
This loess macro is pretty clean too by the way, it's (mostly) not a muncher and you can use `{#raw { … }}` to emit long runs of token trees more efficiently also at runtime.