Skip to content

Commit

Permalink
chore: v15.7.1 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephLenton authored Sep 7, 2024
1 parent 2652d29 commit e8acc48
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "axum-test"
authors = ["Joseph Lenton <josephlenton@gmail.com>"]
version = "15.7.0"
version = "15.7.1"
rust-version = "1.75"
edition = "2021"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/internals/transport_layer/mock_transport_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ where

impl<S, RouterService> TransportLayer for MockTransportLayer<S>
where
S: Service<Request<Body>, Response = RouterService> + Clone + Send + std::marker::Sync,
S: Service<Request<Body>, Response = RouterService> + Clone + Send + Sync + 'static,
AnyhowError: From<S::Error>,
S::Future: Send + std::marker::Sync,
S::Future: Send + Sync,
RouterService: Service<Request<Body>, Response = AxumResponse>,
AnyhowError: From<RouterService::Error>,
{
Expand Down
4 changes: 2 additions & 2 deletions src/transport_layer/into_transport_layer/into_make_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ where
S: Service<AxumRequest, Response = AxumResponse, Error = Infallible>
+ Clone
+ Send
+ 'static
+ std::marker::Sync,
+ Sync
+ 'static,
S::Future: Send,
{
fn into_http_transport_layer(
Expand Down
19 changes: 18 additions & 1 deletion src/transport_layer/transport_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use url::Url;

use crate::transport_layer::TransportLayerType;

pub trait TransportLayer: Debug + Send + std::marker::Sync {
pub trait TransportLayer: Debug + Send + Sync + 'static {
fn send<'a>(
&'a self,
request: Request<Body>,
Expand All @@ -21,3 +21,20 @@ pub trait TransportLayer: Debug + Send + std::marker::Sync {

fn get_type(&self) -> TransportLayerType;
}

#[cfg(test)]
mod test_sync {
use super::*;
use tokio::sync::OnceCell;

#[test]
fn it_should_compile_with_tokyo_once_cell() {
// if it compiles, it works!
fn _take_tokio_once_cell<T>(layer: T) -> OnceCell<Box<dyn TransportLayer>>
where
T: TransportLayer,
{
OnceCell::new_with(Some(Box::new(layer)))
}
}
}

0 comments on commit e8acc48

Please sign in to comment.