From 3116db5168c7125e9714d636d586f95e29f3c8b3 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 15 Jan 2020 13:24:38 -0800 Subject: [PATCH] revert 1.0.3 changes --- actix-service/CHANGES.md | 6 ++++++ actix-service/Cargo.toml | 3 +-- actix-service/src/and_then.rs | 18 ++++++++---------- actix-service/src/pipeline.rs | 9 +++------ actix-tracing/Cargo.toml | 5 ++--- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/actix-service/CHANGES.md b/actix-service/CHANGES.md index 61d082d3..0dcc6103 100644 --- a/actix-service/CHANGES.md +++ b/actix-service/CHANGES.md @@ -1,5 +1,11 @@ # Changes +## [1.0.4] - 2020-01-15 + +### Fixed + +* Revert 1.0.3 change + ## [1.0.3] - 2020-01-15 ### Fixed diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index e6546972..045585a8 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-service" -version = "1.0.3" +version = "1.0.4" authors = ["Nikolay Kim "] description = "Actix service" keywords = ["network", "framework", "async", "futures"] @@ -13,7 +13,6 @@ edition = "2018" [badges] travis-ci = { repository = "actix/actix-service", branch = "master" } -appveyor = { repository = "actix/actix-net" } codecov = { repository = "actix/actix-service", branch = "master", service = "github" } [lib] diff --git a/actix-service/src/and_then.rs b/actix-service/src/and_then.rs index 44f6101d..07ddc01a 100644 --- a/actix-service/src/and_then.rs +++ b/actix-service/src/and_then.rs @@ -9,7 +9,7 @@ use crate::cell::Cell; /// of another service which completes successfully. /// /// This is created by the `ServiceExt::and_then` method. -pub struct AndThenService(Cell<(A, B)>); +pub struct AndThenService(Cell, Cell); impl AndThenService { /// Create new `AndThen` combinator @@ -18,13 +18,13 @@ impl AndThenService { A: Service, B: Service, { - Self(Cell::new((a, b))) + Self(Cell::new(a), Cell::new(b)) } } impl Clone for AndThenService { fn clone(&self) -> Self { - AndThenService(self.0.clone()) + AndThenService(self.0.clone(), self.1.clone()) } } @@ -39,10 +39,8 @@ where type Future = AndThenServiceResponse; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { - let srv = self.0.get_mut(); - - let not_ready = !srv.0.poll_ready(cx)?.is_ready(); - if !srv.1.poll_ready(cx)?.is_ready() || not_ready { + let not_ready = { !self.0.get_mut().poll_ready(cx)?.is_ready() }; + if !self.1.poll_ready(cx)?.is_ready() || not_ready { Poll::Pending } else { Poll::Ready(Ok(())) @@ -51,7 +49,7 @@ where fn call(&mut self, req: A::Request) -> Self::Future { AndThenServiceResponse { - state: State::A(self.0.get_mut().0.call(req), Some(self.0.clone())), + state: State::A(self.0.get_mut().call(req), Some(self.1.clone())), } } } @@ -72,7 +70,7 @@ where A: Service, B: Service, { - A(#[pin] A::Future, Option>), + A(#[pin] A::Future, Option>), B(#[pin] B::Future), Empty, } @@ -94,7 +92,7 @@ where Poll::Ready(res) => { let mut b = b.take().unwrap(); this.state.set(State::Empty); // drop fut A - let fut = b.get_mut().1.call(res); + let fut = b.get_mut().call(res); this.state.set(State::B(fut)); self.poll(cx) } diff --git a/actix-service/src/pipeline.rs b/actix-service/src/pipeline.rs index 4b0ecc25..d6107ce4 100644 --- a/actix-service/src/pipeline.rs +++ b/actix-service/src/pipeline.rs @@ -50,7 +50,7 @@ impl Pipeline { where Self: Sized, F: IntoService, - U: Service + 'static, + U: Service, { Pipeline { service: AndThenService::new(self.service, service.into_service()), @@ -69,7 +69,7 @@ impl Pipeline { where Self: Sized, I: IntoService, - U: Service + 'static, + U: Service, F: FnMut(T::Response, &mut U) -> Fut, Fut: Future>, Err: From + From, @@ -88,7 +88,7 @@ impl Pipeline { where Self: Sized, F: IntoService, - U: Service, Error = T::Error> + 'static, + U: Service, Error = T::Error>, { Pipeline { service: ThenService::new(self.service, service.into_service()), @@ -179,7 +179,6 @@ impl PipelineFactory { Error = T::Error, InitError = T::InitError, >, - U::Service: 'static, { PipelineFactory { factory: AndThenServiceFactory::new(self.factory, factory.into_factory()), @@ -200,7 +199,6 @@ impl PipelineFactory { T::Config: Clone, I: IntoServiceFactory, U: ServiceFactory, - U::Service: 'static, F: FnMut(T::Response, &mut U::Service) -> Fut + Clone, Fut: Future>, Err: From + From, @@ -227,7 +225,6 @@ impl PipelineFactory { Error = T::Error, InitError = T::InitError, >, - U::Service: 'static, { PipelineFactory { factory: ThenServiceFactory::new(self.factory, factory.into_factory()), diff --git a/actix-tracing/Cargo.toml b/actix-tracing/Cargo.toml index 60927c12..322ff983 100644 --- a/actix-tracing/Cargo.toml +++ b/actix-tracing/Cargo.toml @@ -10,15 +10,14 @@ documentation = "https://docs.rs/actix-tracing/" categories = ["network-programming", "asynchronous"] license = "MIT/Apache-2.0" edition = "2018" -workspace = ".." [lib] name = "actix_tracing" path = "src/lib.rs" [dependencies] -actix-service = "1.0" -futures-util = "0.3" +actix-service = "1.0.3" +futures-util = "0.3.1" tracing = "0.1" tracing-futures = "0.2"