From cf71b847e778e09e7dc9127f8f8b67af1699f227 Mon Sep 17 00:00:00 2001 From: Matt Fellenz Date: Mon, 18 Apr 2022 10:54:01 -0700 Subject: [PATCH] Suggest LocalBoxFuture specifically --- actix-web/src/extract.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/actix-web/src/extract.rs b/actix-web/src/extract.rs index 684afb0aa..88a401a3d 100644 --- a/actix-web/src/extract.rs +++ b/actix-web/src/extract.rs @@ -68,9 +68,13 @@ pub trait FromRequest: Sized { /// Future that resolves to a Self. /// - /// To refer to the type of an async function or block here, you have two options. - /// The first is to use a boxed future such as `futures::future::BoxFuture`. This works on stable and nightly. - /// The second is to use `impl Future`, which requires `#![feature(type_alias_impl_trait)]` so only works on nightly. + /// To use an async function or block here, you can a boxed future such as `futures::future::LocalBoxFuture`. + /// This is an alias for a pinned Box, so you can create it with the following syntax: + /// ``` + /// Box::pin(async { + /// ... + /// }) + /// ``` type Future: Future>; /// Create a Self from request parts asynchronously.