Replies: 1 comment 3 replies
-
At least the last time I tried the |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to raise this conversation because I have limited understanding of how scoped futures works. We use diesel async a lot in our codebase (as you know) and we love being able to share references with a diesel transaction future, which is something only scoped futures allows (alongside this library, of course).
With the help of @guissalustiano we were testing to see if diesel-async scoped futures could be replaced by async closures in signatures. The reason we were curious was at first because it'd be cleaner for us in our codebase to rely on a rust syntax instead of explicit boxing or calling scoped future everywhere. We currently have more than a thousand of such query boxing!
So with this change main...guissalustiano:diesel_async:use_async_clousure we were really surprised to see some of these diesel transactions and queries were compiling cleanly, just replacing the
|conn|Box::pin(async { ... })
withasync |conn| { }
.So this discussion is in order to discuss, could the scoped futures library be replaced by the new syntax? Is there some lifetime edge case the new syntax does not cover? Am I misunderstanding something about the relationship between scoped futures and diesel async?
I'd love to understand better this situation and if it made sense to pursue such a change, which of course me and @guissalustiano would be more than willing to help with.
Thanks for the attention!
Beta Was this translation helpful? Give feedback.
All reactions