mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-17 00:00:16 +02:00
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:
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user