-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async helper #157
Comments
Support for asynchronous helpers would help me a lot in sqlpage Currently I hand-roll my own template-splitting solution to be able to call rennder across await points, but this is less than ideal. |
I’m quite new to Rust so I might be thinking about things incorrectly but this might be helpful for the application I’m working on for a voice response system; I’d love to have a helper that’s passed the name of a prompt that checks the database to see if it has a recording and uses a fallback string if not. |
I found it's almost impossible to have both sync and async helper supported simultaneously because async function require that full invocation path to be async. I will recommend you not to put your logic into helper. You'd better fetch all data required by the template and put them into the context. Helper are suitable for formatting, complex if/else check but not IO tasks. |
👍🏻 that’s what I did end up with, thanks for the feedback 😀 |
What if we want some asynchronous tasks in handler helpers? With current API you might be able to do that but there is no guarantee on the order of writes on template string buffer.
Perhaps we will need a
future-rs
based API for this task? Will it be in the core library or as an extension?The text was updated successfully, but these errors were encountered: