mirror of
https://github.com/tokio-rs/axum.git
synced 2025-04-26 13:56:22 +02:00
Drop Sync
requirement on the handler function (#522)
Since it doesn't need to be called from different threads at the same time.
This commit is contained in:
parent
e2e9f1ff68
commit
3cf8ee3b5e
2 changed files with 4 additions and 4 deletions
|
@ -346,7 +346,7 @@ mod debug {
|
|||
|
||||
fn debug_handler<F, Fut, #(#generics),*>(_f: F)
|
||||
where
|
||||
F: ::std::ops::FnOnce(#(#generics),*) -> Fut + Clone + Send + Sync + 'static,
|
||||
F: ::std::ops::FnOnce(#(#generics),*) -> Fut + Clone + Send + 'static,
|
||||
Fut: ::std::future::Future + Send,
|
||||
{}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
//! - Are `async fn`s.
|
||||
//! - Take no more than 16 arguments that all implement [`FromRequest`].
|
||||
//! - Returns something that implements [`IntoResponse`].
|
||||
//! - If a closure is used it must implement `Clone + Send + Sync` and be
|
||||
//! - If a closure is used it must implement `Clone + Send` and be
|
||||
//! `'static`.
|
||||
//! - Returns a future that is `Send`. The most common way to accidentally make a
|
||||
//! future `!Send` is to hold a `!Send` type across an await.
|
||||
|
@ -264,7 +264,7 @@ pub trait Handler<B, T>: Clone + Send + Sized + 'static {
|
|||
#[async_trait]
|
||||
impl<F, Fut, Res, B> Handler<B, ()> for F
|
||||
where
|
||||
F: FnOnce() -> Fut + Clone + Send + Sync + 'static,
|
||||
F: FnOnce() -> Fut + Clone + Send + 'static,
|
||||
Fut: Future<Output = Res> + Send,
|
||||
Res: IntoResponse,
|
||||
B: Send + 'static,
|
||||
|
@ -282,7 +282,7 @@ macro_rules! impl_handler {
|
|||
#[allow(non_snake_case)]
|
||||
impl<F, Fut, B, Res, $($ty,)*> Handler<B, ($($ty,)*)> for F
|
||||
where
|
||||
F: FnOnce($($ty,)*) -> Fut + Clone + Send + Sync + 'static,
|
||||
F: FnOnce($($ty,)*) -> Fut + Clone + Send + 'static,
|
||||
Fut: Future<Output = Res> + Send,
|
||||
B: Send + 'static,
|
||||
Res: IntoResponse,
|
||||
|
|
Loading…
Add table
Reference in a new issue