mirror of https://github.com/fafhrd91/actix-web
Suggest LocalBoxFuture specifically
This commit is contained in:
parent
e575d35da2
commit
cf71b847e7
|
@ -68,9 +68,13 @@ pub trait FromRequest: Sized {
|
||||||
|
|
||||||
/// Future that resolves to a Self.
|
/// Future that resolves to a Self.
|
||||||
///
|
///
|
||||||
/// To refer to the type of an async function or block here, you have two options.
|
/// To use an async function or block here, you can a boxed future such as `futures::future::LocalBoxFuture`.
|
||||||
/// The first is to use a boxed future such as `futures::future::BoxFuture`. This works on stable and nightly.
|
/// This is an alias for a pinned Box, so you can create it with the following syntax:
|
||||||
/// The second is to use `impl Future`, which requires `#![feature(type_alias_impl_trait)]` so only works on nightly.
|
/// ```
|
||||||
|
/// Box::pin(async {
|
||||||
|
/// ...
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
type Future: Future<Output = Result<Self, Self::Error>>;
|
type Future: Future<Output = Result<Self, Self::Error>>;
|
||||||
|
|
||||||
/// Create a Self from request parts asynchronously.
|
/// Create a Self from request parts asynchronously.
|
||||||
|
|
Loading…
Reference in New Issue