Relax implicit Send / Sync bounds (#3555)

This commit is contained in:
Jonas Platte
2025-11-14 20:41:03 +01:00
parent a05920c906
commit 4fc3faa0b4
2 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -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, ()>>();
}
+2 -2
View File
@@ -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")))]