Actix Web FromRequest where Future != Ready?

I have written a couple of FromRequest implementations while using Actix Web, but they have all been synchronous, using Ready as the associated Future type. Now I've finally found a situation where I do in fact need to do something asynchronous inside the FromRequest implementation.

So let's say I write this implementation:

impl FromRequest for . . {
    type Error = ...;
    fn from_request(...) -> Self::Future {
        async { ... }
    }
    type Future = ???;
}

What type am I meant to put for Future? I tried impl Future but apparently that's unstable, and I verified that it does in fact work properly in nightly with the required feature gate. Am I going to have to switch to nightly?

BTW, I know I can do the asynchronous part inside the actual route handler, but I would really like to avoid doing that because adding a parameter to the function and having it be handled automatically is so much nicer.

You have to box the future. You can use the futures::future::BoxFuture<'static, ReturnValueHere> type alias from the futures crate as the type.

impl FromRequest {
    type Error = ...;
    fn from_request(...) -> Self::Future {
        Box::pin(async { ... })
    }
    type Future = BoxFuture<'static, ...>;
}

Okay, thank you. For now I think I will continue to use nightly and impl Future.