-
Notifications
You must be signed in to change notification settings - Fork 46
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
Convert actix-web extractors to async await #544
Comments
@fzzzy, I'd like to work on this issue. |
@fzzzy Since Rust doesn't support Async in traits, can we utilize one of the following approaches
|
Partial Fix. Convert extractors from Futures style to async await. This implementation utilizes trait objects as return values from the refactored functions because Rust doesn't support `async fn` in traits. Issue mozilla-services#544
Thanks. I looked at b15cf0d and I don't think we want to use the dyn Future approach. Did you try using Async Trait? That is what we are planning on moving to in the whole codebase eventually. In the meantime, you can find other places in the codebase where we work around this. We do it by using a non-async function in the impl, but then using an async closure inside that to be able to use async syntax. However, I think this can also be replaced with Async Trait. |
Yes, I've suggested using async trait in the previous comment and I wanted a confirmation on whether I should introduce new dependencies. So, can I go back to writing these functions using async trait? |
Yes, please do. Hopefully it works easily. If not, discuss it in the channel. |
I could be wrong about this, but since the |
AFAIK you're right: it's not possible to use |
There are certain places where we store a |
This was already completed with a few different PRs, closing |
In the
FromRequest
implementations forBsoBodies
andBsoBody
, we invokeand_then()
on theFuture
returned by anotherfrom_request()
invocation. Now that Rust supports async/await, this is no longer idiomatic. Instead, we should wrap thefrom_request()
invocation in aBox::pin(async move { ... })
block as we do in the other extractors. This would allow us to use async/await.The text was updated successfully, but these errors were encountered: