Finja: What If Your Rust Function Was a Jinja Template?
#[finja(
welcomer => "println!",
greeting => "Hello, {}",
name => "guest2"
)]
fn main() {
let guest1 = "Universe";
let guest2 = "World";
{{ welcomer }}("{{ greeting }}", {{ name }});
}
Hi! I made this just for fun - it’s a little experiment that enables Jinja templating (using minijinja) directly on Rust function bodies using an attribute macro.
The code of the function becomes a template that is rendered in the compile time using provided parameters.
There's a slightly more complex example in the repository: https://github.com/synek317/finja
50% of me loves it, 50% thinks it's too much magic.
What do you think?