djc / askama

Type-safe, compiled Jinja-like templates for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allowing imports and macro declaration everywhere?

GuillaumeGomez opened this issue · comments

It's currently not possible to use import or to declare macro if it's not in the top level, which is very quickly problematic in case you have includes and equivalents.

So questions are:

  • Is there a reason for this limitation?
  • Would you be open to lifting it?

See also #915. I'm on the fence about it a little? I'd like to see clear use cases for these and ideally also understand the performance impact on the codegen setup.

I wonder if #915 can cover my use-case, it's a bit more limited. Gonna give it a try.

As for performance impact, I'm curious about it as well. We can ask for some comparison.