mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-15 00:00:20 +02:00
Relax implicit Send / Sync bounds (#3555)
This commit is contained in:
@@ -592,7 +592,7 @@ where
|
||||
/// See [`Router::as_service`] for more details.
|
||||
pub struct RouterAsService<'a, B, S = ()> {
|
||||
router: &'a mut Router<S>,
|
||||
_marker: PhantomData<B>,
|
||||
_marker: PhantomData<fn(B)>,
|
||||
}
|
||||
|
||||
impl<B> Service<Request<B>> for RouterAsService<'_, B, ()>
|
||||
@@ -631,7 +631,7 @@ where
|
||||
/// See [`Router::into_service`] for more details.
|
||||
pub struct RouterIntoService<B, S = ()> {
|
||||
router: Router<S>,
|
||||
_marker: PhantomData<B>,
|
||||
_marker: PhantomData<fn(B)>,
|
||||
}
|
||||
|
||||
impl<B, S> Clone for RouterIntoService<B, S>
|
||||
@@ -800,4 +800,8 @@ fn traits() {
|
||||
use crate::test_helpers::*;
|
||||
assert_send::<Router<()>>();
|
||||
assert_sync::<Router<()>>();
|
||||
assert_send::<RouterAsService<'static, Body, ()>>();
|
||||
assert_sync::<RouterAsService<'static, Body, ()>>();
|
||||
assert_send::<RouterIntoService<Body, ()>>();
|
||||
assert_sync::<RouterIntoService<Body, ()>>();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ where
|
||||
pub struct Serve<L, M, S> {
|
||||
listener: L,
|
||||
make_service: M,
|
||||
_marker: PhantomData<S>,
|
||||
_marker: PhantomData<fn() -> S>,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "tokio", any(feature = "http1", feature = "http2")))]
|
||||
@@ -239,7 +239,7 @@ pub struct WithGracefulShutdown<L, M, S, F> {
|
||||
listener: L,
|
||||
make_service: M,
|
||||
signal: F,
|
||||
_marker: PhantomData<S>,
|
||||
_marker: PhantomData<fn() -> S>,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "tokio", any(feature = "http1", feature = "http2")))]
|
||||
|
||||
Reference in New Issue
Block a user