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
@@ -17,6 +17,13 @@ pub struct IntoService<H, B, T> {
_marker: PhantomData<fn() -> (B, T)>,
}
#[test]
fn traits() {
use crate::tests::*;
assert_send::<IntoService<(), NotSendSync, NotSendSync>>();
assert_sync::<IntoService<(), NotSendSync, NotSendSync>>();
}
impl<H, B, T> IntoService<H, B, T> {
pub(super) fn new(handler: H) -> Self {
Self {
+7
View File
@@ -441,6 +441,13 @@ pub struct OnMethod<H, B, T, F> {
pub(crate) _marker: PhantomData<fn() -> (B, T)>,
}
#[test]
fn traits() {
use crate::tests::*;
assert_send::<OnMethod<(), NotSendSync, NotSendSync, ()>>();
assert_sync::<OnMethod<(), NotSendSync, NotSendSync, ()>>();
}
impl<H, B, T, F> fmt::Debug for OnMethod<H, B, T, F>
where
T: fmt::Debug,