From e66312b664f183a80eae6a9de3e9c8667b08241e Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 10 Jan 2020 11:36:59 +0600 Subject: [PATCH] add extra constraints --- Cargo.toml | 8 ++++---- actix-http/src/cloneable.rs | 16 +++++----------- actix-http/src/h1/service.rs | 2 +- actix-http/src/h2/service.rs | 2 +- actix-http/src/service.rs | 2 +- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1adae97b8..9e1b559eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,9 +60,9 @@ rustls = ["actix-tls/rustls", "awc/rustls", "rust-tls"] [dependencies] actix-codec = "0.2.0" -actix-service = "1.0.1" -actix-utils = "1.0.4" -actix-router = "0.2.1" +actix-service = "1.0.2" +actix-utils = "1.0.6" +actix-router = "0.2.4" actix-rt = "1.0.0" actix-server = "1.0.0" actix-testing = "1.0.0" @@ -115,4 +115,4 @@ actix-identity = { path = "actix-identity" } actix-session = { path = "actix-session" } actix-files = { path = "actix-files" } actix-multipart = { path = "actix-multipart" } -awc = { path = "awc" } \ No newline at end of file +awc = { path = "awc" } diff --git a/actix-http/src/cloneable.rs b/actix-http/src/cloneable.rs index 90d198b9c..65c6bec21 100644 --- a/actix-http/src/cloneable.rs +++ b/actix-http/src/cloneable.rs @@ -6,27 +6,21 @@ use actix_service::Service; #[doc(hidden)] /// Service that allows to turn non-clone service to a service with `Clone` impl -pub(crate) struct CloneableService(Rc>); +pub(crate) struct CloneableService(Rc>); -impl CloneableService { - pub(crate) fn new(service: T) -> Self - where - T: Service, - { +impl CloneableService { + pub(crate) fn new(service: T) -> Self { Self(Rc::new(UnsafeCell::new(service))) } } -impl Clone for CloneableService { +impl Clone for CloneableService { fn clone(&self) -> Self { Self(self.0.clone()) } } -impl Service for CloneableService -where - T: Service, -{ +impl Service for CloneableService { type Request = T::Request; type Response = T::Response; type Error = T::Error; diff --git a/actix-http/src/h1/service.rs b/actix-http/src/h1/service.rs index 69c8fc55c..4d1a1dc1b 100644 --- a/actix-http/src/h1/service.rs +++ b/actix-http/src/h1/service.rs @@ -364,7 +364,7 @@ where } /// `Service` implementation for HTTP1 transport -pub struct H1ServiceHandler { +pub struct H1ServiceHandler { srv: CloneableService, expect: CloneableService, upgrade: Option>, diff --git a/actix-http/src/h2/service.rs b/actix-http/src/h2/service.rs index 7cae99f5b..ff3f69faf 100644 --- a/actix-http/src/h2/service.rs +++ b/actix-http/src/h2/service.rs @@ -246,7 +246,7 @@ where } /// `Service` implementation for http/2 transport -pub struct H2ServiceHandler { +pub struct H2ServiceHandler { srv: CloneableService, cfg: ServiceConfig, on_connect: Option Box>>, diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs index 82618289b..51de95135 100644 --- a/actix-http/src/service.rs +++ b/actix-http/src/service.rs @@ -443,7 +443,7 @@ where } /// `Service` implementation for http transport -pub struct HttpServiceHandler { +pub struct HttpServiceHandler { srv: CloneableService, expect: CloneableService, upgrade: Option>,