Closed breard-r closed 1 year ago
I'm not sure an async function alone would solve it. For this to make sense the engine engine would have to run in a compatible mainloop as well. I think you are probably better off writing this particular stuff sync and block on the async stuff to come back. You can still make the outer part async too by moving the enter rendering into a thread pool if that's necessary.
Generally making this async would require significant changes in the engine and it would invalidate a lot of the assumptions i want to uphold of the engine (mostly that the stack does not go away). The minijinja-stack-ref experiment entirely depends on this.
I'm closing this as wontfix since the complexity of this is not worth the benefit.
Hello,
Currently, it's possible to create a source with a dynamic loader using
Source::with_loader
which accepts a callback function. That's really great but quite impractical to use in async code, therefore I would like to suggest the addition of a similar function that accepts an async callback (Source::with_async_loader
maybe?). For example, that would be handy if one would like to fetch the template from a database using an asynchronous method.