diff --git a/tower/CHANGELOG.md b/tower/CHANGELOG.md index 1ba702af1..1cfdad1d6 100644 --- a/tower/CHANGELOG.md +++ b/tower/CHANGELOG.md @@ -9,15 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `MakeService::into_service` and `MakeService::as_service` for converting `MakeService`s into `Service`s. -- Make `ServiceBuilder::service` take `self` by reference rather than by value. ### Changed - - All middleware `tower-*` crates were merged into `tower` and placed - behind feature flags. +- All middleware `tower-*` crates were merged into `tower` and placed + behind feature flags. +- Make `ServiceBuilder::service` take `self` by reference rather than by value. ### Removed +- Remove `ServiceExt::ready`. + # 0.3.1 (January 17, 2020) - Allow opting out of tracing/log (#410). diff --git a/tower/src/util/mod.rs b/tower/src/util/mod.rs index 972f8ef2e..7537779cd 100644 --- a/tower/src/util/mod.rs +++ b/tower/src/util/mod.rs @@ -27,7 +27,7 @@ pub use self::{ map_result::{MapResult, MapResultLayer}, oneshot::Oneshot, optional::Optional, - ready::{Ready, ReadyAnd, ReadyOneshot}, + ready::{ReadyAnd, ReadyOneshot}, service_fn::{service_fn, ServiceFn}, then::{Then, ThenLayer}, try_map_request::{TryMapRequest, TryMapRequestLayer}, @@ -55,16 +55,6 @@ pub mod future { /// An extension trait for `Service`s that provides a variety of convenient /// adapters pub trait ServiceExt: tower_service::Service { - /// Resolves when the service is ready to accept a request. - #[deprecated(since = "0.3.1", note = "prefer `ready_and` which yields the service")] - fn ready(&mut self) -> Ready<'_, Self, Request> - where - Self: Sized, - { - #[allow(deprecated)] - Ready::new(self) - } - /// Yields a mutable reference to the service when it is ready to accept a request. fn ready_and(&mut self) -> ReadyAnd<'_, Self, Request> where diff --git a/tower/src/util/ready.rs b/tower/src/util/ready.rs index 35cec96b1..2f3ec140b 100644 --- a/tower/src/util/ready.rs +++ b/tower/src/util/ready.rs @@ -97,45 +97,3 @@ where f.debug_tuple("ReadyAnd").field(&self.0).finish() } } - -// ==== deprecated `Ready` that is just `ReadyAnd` with a unit return type. - -/// A future that resolves when a `Service` is ready to accept a request. -/// -/// `Ready` values are produced by `ServiceExt::ready`. -pub struct Ready<'a, T, Request>(ReadyAnd<'a, T, Request>); - -// Safety: This is safe for the same reason that the impl for ReadyOneshot is safe. -impl<'a, T, Request> Unpin for Ready<'a, T, Request> {} - -impl<'a, T, Request> Ready<'a, T, Request> -where - T: Service, -{ - #[allow(missing_docs)] - #[deprecated(since = "0.3.1", note = "prefer `ReadyAnd` which yields the service")] - pub fn new(service: &'a mut T) -> Self { - Self(ReadyAnd::new(service)) - } -} - -impl<'a, T, Request> Future for Ready<'a, T, Request> -where - T: Service, -{ - type Output = Result<(), T::Error>; - - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - let _ = ready!(Pin::new(&mut self.0).poll(cx)); - Poll::Ready(Ok(())) - } -} - -impl<'a, T, Request> fmt::Debug for Ready<'a, T, Request> -where - T: fmt::Debug, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("Ready").field(&self.0).finish() - } -}