Interpolation
Insert any expression that implements ToTokens with double braces:
zyn! { fn {{ name }}() -> {{ ret_type }} {} }
// output: fn hello() -> String {}
Field Access
Dot notation works inside interpolation:
zyn! {
{{ item.field.name }}: {{ item.field.ty }},
}
// output: age: u32,
Method Calls
zyn! {
{{ names.len() }}
}
// output: 3
Groups
Interpolation works inside parenthesized and bracketed groups:
zyn! { fn foo(x: {{ ty }}) }
// output: fn foo(x: u32)
zyn! { type Foo = [{{ ty }}; 4]; }
// output: type Foo = [u32; 4];