Add Send + Sync check to all services (#277)

Should prevent us accidentally introducing breaking changes.

Fixes https://github.com/tokio-rs/axum/issues/275
This commit is contained in:
David Pedersen
2021-08-26 20:59:55 +02:00
committed by GitHub
parent e6ca9e4b04
commit 4c5068c01f
8 changed files with 77 additions and 0 deletions
+7
View File
@@ -29,6 +29,13 @@ pub struct IntoMakeServiceWithConnectInfo<S, C> {
_connect_info: PhantomData<fn() -> C>,
}
#[test]
fn traits() {
use crate::tests::*;
assert_send::<IntoMakeServiceWithConnectInfo<(), NotSendSync>>();
assert_sync::<IntoMakeServiceWithConnectInfo<(), NotSendSync>>();
}
impl<S, C> IntoMakeServiceWithConnectInfo<S, C> {
pub(crate) fn new(svc: S) -> Self {
Self {
+7
View File
@@ -132,6 +132,13 @@ pub struct ExtractorMiddleware<S, E> {
_extractor: PhantomData<fn() -> E>,
}
#[test]
fn traits() {
use crate::tests::*;
assert_send::<ExtractorMiddleware<(), NotSendSync>>();
assert_sync::<ExtractorMiddleware<(), NotSendSync>>();
}
impl<S, E> Clone for ExtractorMiddleware<S, E>
where
S: Clone,