async fn(Request) -> Result
Filter::check
and AsyncFilter::check
methods which check a
request against the filter's Predicate
(#521)get_ref
, get_mut
, and into_inner
methods to Filter
and AsyncFilter
, allowing access to the wrapped service (#522)layer
associated function to AndThen
, Then
,
MapRequest
, MapResponse
, and MapResult
types. These return a Layer
that produces middleware of that type, as a convenience to avoid having to
import the Layer
type separately. (#524)Clone
impls to AndThenLayer
, MapRequestLayer
,
and MapErrLayer
, when the mapped function implements Clone
(#525)FutureService::new
constructor, with less restrictive bounds
than the future_service
free function (#523)This is a major breaking release including a large number of changes. In
particular, this release updates tower
to depend on Tokio 1.0, and moves all
middleware into the tower
crate. In addition, Tower 0.4 reworks several
middleware APIs, as well as introducing new ones.
This release does not change the core Service
or Layer
traits, so tower
0.4 still depends on tower-service
0.3 and tower-layer
0.3. This means that
tower
0.4 is still compatible with libraries that depend on those crates.
MakeService::into_service
and MakeService::as_service
for
converting MakeService
s into Service
s (#492)steer
middleware for routing requests to one of a set of
services (#426)MapRequest
middleware and ServiceExt::map_request
, for
applying a function to a request before passing it to the inner service
(#435)MapResponse
middleware and ServiceExt::map_response
, for
applying a function to the Response
type of an inner service after its
future completes (#435)MapErr
middleware and ServiceExt::map_err
, for
applying a function to the Error
returned by an inner service if it fails
(#396)MapResult
middleware and ServiceExt::map_result
, for
applying a function to the Result
returned by an inner service's future
regardless of whether it succeeds or fails (#499)Then
middleware and ServiceExt::then
, for chaining another
future after an inner service's future completes (with a Response
or an
Error
) (#500)AndThen
middleware and ServiceExt::and_then
, for
chaining another future after an inner service's future completes successfully
(#485)layer_fn
, for constructing a Layer
from a function taking
a Service
and returning a different Service
(#491)FutureService
, which implements Service
for a
Future
whose Output
type is a Service
([#496])BoxService::layer
and UnsyncBoxService::layer
, to make
constructing layers more ergonomic (#503)Layer
impl for &Layer
(#446)Retry::get_ref
, Retry::get_mut
, and Retry::into_inner
to access the inner service (#463)Timeout::get_ref
, Timeout::get_mut
, and
Timeout::into_inner
to access the inner service (#463)Clone
and Copy
impls for BufferLayer
(#493)tower-*
crates were merged into tower
and placed
behind feature flags (#432)ServiceBuilder::service
take self
by reference rather
than by value (#504)MakeService
in the response future, rather than
in poll_ready
, allowing the reconnect service to be reused when a reconnect
fails (#386, #437)Discover
to be a sealed trait alias for a
TryStream<Item = Change>
. Discover
implementations are now written by
implementing Stream
. (#443)Instrument
trait to TrackCompletion
(#445)NoInstrument
to CompleteOnResponse
(#445)BalanceLayer
to MakeBalanceLayer
(#449)BalanceMake
to MakeBalance
(#449)ready_cache::error::Failed
's fmt::Debug
impl to
require the key type to also implement fmt::Debug
(#467)Filter
and Predicate
to use a synchronous function as
a predicate (#508)Filter
and Predicate
(where Predicate
s
returned a Future
) to AsyncFilter
and AsyncPredicate
(#508)Predicate
s now take a Request
type by value and may return a
new request, potentially of a different type (#508)Predicate
s may now return an error of any type (#508)RateLimit
services do not reset the remaining
count when rate limiting (#438, [#439])oneshot
futures panic if the service does not
immediately become ready (#447)ready_cache::error::Failed
not returning inner error types
via Error::source
(#467)buffer
where buffer
slots were
eagerly reserved for hedge requests even if they were not sent (#472)