Closed sunkaifei closed 4 months ago
This example shows how you can invoke async functions in your templates: https://github.com/mitsuhiko/minijinja/blob/main/examples/object-using-async/src/main.rs
What call_method
there is doing you can also do in a function added with add_function
. You would however need to pass the handle by other means.
I added a better example here: https://github.com/mitsuhiko/minijinja/blob/main/examples/function-using-async/src/main.rs
Dear author, hello. I was unsuccessful in trying under activx_web because I wanted the template to be able to automatically reload and also have the add_function to call asynchronous functions. As I have just started working with this engine, it is challenging for beginners to write an example that can both automatically reload templates and call asynchronous functions. If you have time, I hope you can provide an example of activx_web to facilitate our learning. Thank you very much for your prompt reply. Thank you
Do you know anything? Because if all templates can call asynchronous data in the form of tags, the controller does not need to call the database, making template development very convenient.