diff --git a/axum-core/src/ext_traits/request.rs b/axum-core/src/ext_traits/request.rs index fba5f2d6d9..1f8a59ea98 100644 --- a/axum-core/src/ext_traits/request.rs +++ b/axum-core/src/ext_traits/request.rs @@ -66,7 +66,7 @@ pub trait RequestExt: sealed::Sealed + Sized { /// } /// } /// ``` - fn extract(self) -> impl Future> + fn extract(self) -> impl Future> + Send where E: FromRequest<(), M> + 'static, M: 'static; @@ -123,7 +123,7 @@ pub trait RequestExt: sealed::Sealed + Sized { fn extract_with_state( self, state: &S, - ) -> impl Future> + ) -> impl Future> + Send where E: FromRequest + 'static, S: Send + Sync; @@ -176,7 +176,7 @@ pub trait RequestExt: sealed::Sealed + Sized { /// } /// } /// ``` - fn extract_parts(&mut self) -> impl Future> + fn extract_parts(&mut self) -> impl Future> + Send where E: FromRequestParts<()> + 'static; @@ -244,7 +244,7 @@ pub trait RequestExt: sealed::Sealed + Sized { fn extract_parts_with_state<'a, E, S>( &'a mut self, state: &'a S, - ) -> impl Future> + 'a + ) -> impl Future> + Send + 'a where E: FromRequestParts + 'static, S: Send + Sync; diff --git a/axum-core/src/ext_traits/request_parts.rs b/axum-core/src/ext_traits/request_parts.rs index 1246e2ca9e..7b3955dc0f 100644 --- a/axum-core/src/ext_traits/request_parts.rs +++ b/axum-core/src/ext_traits/request_parts.rs @@ -52,7 +52,7 @@ pub trait RequestPartsExt: sealed::Sealed + Sized { /// } /// } /// ``` - fn extract(&mut self) -> impl Future> + '_ + fn extract(&mut self) -> impl Future> + Send + '_ where E: FromRequestParts<()> + 'static; @@ -108,7 +108,7 @@ pub trait RequestPartsExt: sealed::Sealed + Sized { fn extract_with_state<'a, E, S>( &'a mut self, state: &'a S, - ) -> impl Future> + 'a + ) -> impl Future> + Send + 'a where E: FromRequestParts + 'static, S: Send + Sync; diff --git a/examples/error-handling-and-dependency-injection/src/main.rs b/examples/error-handling-and-dependency-injection/src/main.rs index fdfa1b7f31..457b764d66 100644 --- a/examples/error-handling-and-dependency-injection/src/main.rs +++ b/examples/error-handling-and-dependency-injection/src/main.rs @@ -125,10 +125,13 @@ type DynUserRepo = Arc; /// A trait that defines things a user repo might support. trait UserRepo { /// Loop up a user by their id. - fn find(&self, user_id: Uuid) -> impl Future>; + fn find(&self, user_id: Uuid) -> impl Future> + Send; /// Create a new user. - fn create(&self, params: CreateUser) -> impl Future>; + fn create( + &self, + params: CreateUser, + ) -> impl Future> + Send; } #[derive(Debug, Serialize)]