1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8# Unreleased
9
10- None.
11
12# 0.4.13 (June 17, 2022)
13
14### Added
15
16- **load_shed**: Public constructor for `Overloaded` error ([#661])
17
18### Fixed
19
20- **util**: Fix hang with `call_all` when the `Stream` of requests is pending
21  ([#656])
22- **ready_cache**: Ensure cancelation is observed by pending services ([#668],
23  fixes [#415])
24- **docs**: Fix a missing section header due to a typo ([#646])
25- **docs**: Fix broken links to `Service` trait ([#659])
26
27
28[#661]: https://github.com/tower-rs/tower/pull/661
29[#656]: https://github.com/tower-rs/tower/pull/656
30[#668]: https://github.com/tower-rs/tower/pull/668
31[#415]: https://github.com/tower-rs/tower/pull/415
32[#646]: https://github.com/tower-rs/tower/pull/646
33[#659]: https://github.com/tower-rs/tower/pull/659
34
35# 0.4.12 (February 16, 2022)
36
37### Fixed
38
39- **hedge**, **load**, **retry**: Fix use of `Instant` operations that can panic
40  on platforms where `Instant` is not monotonic ([#633])
41- Disable `attributes` feature on `tracing` dependency ([#623])
42- Remove unused dependencies and dependency features with some feature
43  combinations ([#603], [#602])
44- **docs**: Fix a typo in the RustDoc for `Buffer` ([#622])
45
46### Changed
47
48- Updated minimum supported Rust version (MSRV) to 1.49.0.
49- **hedge**: Updated `hdrhistogram` dependency to v7.0 ([#602])
50- Updated `tokio-util` dependency to v0.7 ([#638])
51
52[#633]: https://github.com/tower-rs/tower/pull/633
53[#623]: https://github.com/tower-rs/tower/pull/623
54[#603]: https://github.com/tower-rs/tower/pull/603
55[#602]: https://github.com/tower-rs/tower/pull/602
56[#622]: https://github.com/tower-rs/tower/pull/622
57[#638]: https://github.com/tower-rs/tower/pull/638
58
59# 0.4.11 (November 18, 2021)
60
61### Added
62
63- **util**: Add `BoxCloneService` which is a `Clone + Send` boxed `Service` ([#615])
64- **util**: Add `ServiceExt::boxed` and `ServiceExt::boxed_clone` for applying the
65  `BoxService` and `BoxCloneService` middleware ([#616])
66- **builder**: Add `ServiceBuilder::boxed` and `ServiceBuilder::boxed_clone` for
67  applying `BoxService` and `BoxCloneService` layers ([#616])
68
69### Fixed
70
71- **util**: Remove redundant `F: Clone` bound from `ServiceExt::map_request` ([#607])
72- **util**: Remove unnecessary `Debug` bounds from `impl Debug for BoxService` ([#617])
73- **util**: Remove unnecessary `Debug` bounds from `impl Debug for UnsyncBoxService` ([#617])
74- **balance**: Remove redundant `Req: Clone` bound from `Clone` impls
75  for `MakeBalance`, and `MakeBalanceLayer` ([#607])
76- **balance**: Remove redundant `Req: Debug` bound from `Debug` impls
77  for `MakeBalance`, `MakeFuture`, `Balance`, and `Pool` ([#607])
78- **ready-cache**: Remove redundant `Req: Debug` bound from `Debug` impl
79  for `ReadyCache` ([#607])
80- **steer**: Remove redundant `Req: Debug` bound from `Debug` impl
81  for `Steer` ([#607])
82- **docs**: Fix `doc(cfg(...))` attributes
83  of `PeakEwmaDiscover`, and `PendingRequestsDiscover` ([#610])
84
85[#607]: https://github.com/tower-rs/tower/pull/607
86[#610]: https://github.com/tower-rs/tower/pull/610
87[#615]: https://github.com/tower-rs/tower/pull/615
88[#616]: https://github.com/tower-rs/tower/pull/616
89[#617]: https://github.com/tower-rs/tower/pull/617
90
91# 0.4.10 (October 19, 2021)
92
93- Fix accidental breaking change when using the
94  `rustdoc::broken_intra_doc_links` lint ([#605])
95- Clarify that tower's minimum supported rust version is 1.46 ([#605])
96
97[#605]: https://github.com/tower-rs/tower/pull/605
98
99# 0.4.9 (October 13, 2021)
100
101- Migrate to [pin-project-lite] ([#595])
102- **builder**: Implement `Layer` for `ServiceBuilder` ([#600])
103- **builder**: Add `ServiceBuilder::and_then` analogous to
104  `ServiceExt::and_then` ([#601])
105
106[#600]: https://github.com/tower-rs/tower/pull/600
107[#601]: https://github.com/tower-rs/tower/pull/601
108[#595]: https://github.com/tower-rs/tower/pull/595
109[pin-project-lite]: https://crates.io/crates/pin-project-lite
110
111# 0.4.8 (May 28, 2021)
112
113- **builder**: Add `ServiceBuilder::map_result` analogous to
114  `ServiceExt::map_result` ([#583])
115- **limit**: Add `GlobalConcurrencyLimitLayer` to allow reusing a concurrency
116  limit across multiple services ([#574])
117
118[#574]: https://github.com/tower-rs/tower/pull/574
119[#583]: https://github.com/tower-rs/tower/pull/583
120
121# 0.4.7 (April 27, 2021)
122
123### Added
124
125- **builder**: Add `ServiceBuilder::check_service` to check the request,
126    response, and error types of the output service. ([#576])
127- **builder**: Add `ServiceBuilder::check_service_clone` to check the output
128    service can be cloned. ([#576])
129
130### Fixed
131
132- **spawn_ready**: Abort spawned background tasks when the `SpawnReady` service
133  is dropped, fixing a potential task/resource leak (#[581])
134- Fixed broken documentation links ([#578])
135
136[#576]: https://github.com/tower-rs/tower/pull/576
137[#578]: https://github.com/tower-rs/tower/pull/578
138[#581]: https://github.com/tower-rs/tower/pull/581
139
140# 0.4.6 (February 26, 2021)
141
142### Deprecated
143
144- **util**: Deprecated `ServiceExt::ready_and` (renamed to `ServiceExt::ready`).
145  ([#567])
146- **util**: Deprecated `ReadyAnd` future (renamed to `Ready`). ([#567])
147### Added
148
149- **builder**: Add `ServiceBuilder::layer_fn` to add a layer built from a
150  function. ([#560])
151- **builder**: Add `ServiceBuilder::map_future` for transforming the futures
152  produced by a service. ([#559])
153- **builder**: Add `ServiceBuilder::service_fn` for applying `Layer`s to an
154  async function using `util::service_fn`. ([#564])
155- **util**: Add example for `service_fn`. ([#563])
156- **util**: Add `BoxLayer` for creating boxed `Layer` trait objects. ([#569])
157
158[#567]: https://github.com/tower-rs/tower/pull/567
159[#560]: https://github.com/tower-rs/tower/pull/560
160[#559]: https://github.com/tower-rs/tower/pull/559
161[#564]: https://github.com/tower-rs/tower/pull/564
162[#563]: https://github.com/tower-rs/tower/pull/563
163[#569]: https://github.com/tower-rs/tower/pull/569
164
165# 0.4.5 (February 10, 2021)
166
167### Added
168
169- **util**: Add `ServiceExt::map_future`. ([#542])
170- **builder**: Add `ServiceBuilder::option_layer` to optionally add a layer. ([#555])
171- **make**: Add `Shared` which lets you implement `MakeService` by cloning a
172  service. ([#533])
173
174### Fixed
175
176- **util**: Make combinators that contain closures implement `Debug`. They
177  previously wouldn't since closures never implement `Debug`. ([#552])
178- **steer**: Implement `Clone` for `Steer`. ([#554])
179- **spawn-ready**: SpawnReady now propagates the current `tracing` span to
180  spawned tasks ([#557])
181- Only pull in `tracing` for the features that need it. ([#551])
182
183[#542]: https://github.com/tower-rs/tower/pull/542
184[#555]: https://github.com/tower-rs/tower/pull/555
185[#557]: https://github.com/tower-rs/tower/pull/557
186[#533]: https://github.com/tower-rs/tower/pull/533
187[#551]: https://github.com/tower-rs/tower/pull/551
188[#554]: https://github.com/tower-rs/tower/pull/554
189[#552]: https://github.com/tower-rs/tower/pull/552
190
191# 0.4.4 (January 20, 2021)
192
193### Added
194
195- **util**: Implement `Layer` for `Either<A, B>`. ([#531])
196- **util**: Implement `Clone` for `FilterLayer`. ([#535])
197- **timeout**: Implement `Clone` for `TimeoutLayer`. ([#535])
198- **limit**: Implement `Clone` for `RateLimitLayer`. ([#535])
199
200### Fixed
201
202- Added "full" feature which turns on all other features. ([#532])
203- **spawn-ready**: Avoid oneshot allocations. ([#538])
204
205[#531]: https://github.com/tower-rs/tower/pull/531
206[#532]: https://github.com/tower-rs/tower/pull/532
207[#535]: https://github.com/tower-rs/tower/pull/535
208[#538]: https://github.com/tower-rs/tower/pull/538
209
210# 0.4.3 (January 13, 2021)
211
212### Added
213
214- **filter**: `Filter::check` and `AsyncFilter::check` methods which check a
215  request against the filter's `Predicate` ([#521])
216- **filter**: Added `get_ref`, `get_mut`, and `into_inner` methods to `Filter`
217  and `AsyncFilter`, allowing access to the wrapped service ([#522])
218- **util**: Added `layer` associated function to `AndThen`, `Then`,
219  `MapRequest`, `MapResponse`, and `MapResult` types. These return a `Layer`
220  that produces middleware of that type, as a convenience to avoid having to
221  import the `Layer` type separately. ([#524])
222- **util**: Added missing `Clone` impls to `AndThenLayer`, `MapRequestLayer`,
223  and `MapErrLayer`, when the mapped function implements `Clone` ([#525])
224- **util**: Added `FutureService::new` constructor, with less restrictive bounds
225  than the `future_service` free function ([#523])
226
227[#521]: https://github.com/tower-rs/tower/pull/521
228[#522]: https://github.com/tower-rs/tower/pull/522
229[#523]: https://github.com/tower-rs/tower/pull/523
230[#524]: https://github.com/tower-rs/tower/pull/524
231[#525]: https://github.com/tower-rs/tower/pull/525
232
233# 0.4.2 (January 11, 2021)
234
235### Added
236
237- Export `layer_fn` and `LayerFn` from the `tower::layer` module. ([#516])
238
239### Fixed
240
241- Fix missing `Sync` implementation for `Buffer` and `ConcurrencyLimit` ([#518])
242
243[#518]: https://github.com/tower-rs/tower/pull/518
244[#516]: https://github.com/tower-rs/tower/pull/516
245
246# 0.4.1 (January 7, 2021)
247
248### Fixed
249
250- Updated `tower-layer` to 0.3.1 to fix broken re-exports.
251
252# 0.4.0 (January 7, 2021)
253
254This is a major breaking release including a large number of changes. In
255particular, this release updates `tower` to depend on Tokio 1.0, and moves all
256middleware into the `tower` crate. In addition, Tower 0.4 reworks several
257middleware APIs, as well as introducing new ones.
258
259This release does *not* change the core `Service` or `Layer` traits, so `tower`
2600.4 still depends on `tower-service` 0.3 and `tower-layer` 0.3. This means that
261`tower` 0.4 is still compatible with libraries that depend on those crates.
262
263### Added
264
265- **make**: Added `MakeService::into_service` and `MakeService::as_service` for
266  converting `MakeService`s into `Service`s ([#492])
267- **steer**: Added `steer` middleware for routing requests to one of a set of
268  services ([#426])
269- **util**: Added `MapRequest` middleware and `ServiceExt::map_request`, for
270  applying a function to a request before passing it to the inner service
271  ([#435])
272- **util**: Added `MapResponse` middleware and `ServiceExt::map_response`, for
273  applying a function to the `Response` type of an inner service after its
274  future completes ([#435])
275- **util**: Added `MapErr` middleware and `ServiceExt::map_err`, for
276  applying a function to the `Error` returned by an inner service if it fails
277  ([#396])
278- **util**: Added `MapResult` middleware and `ServiceExt::map_result`, for
279  applying a function to the `Result` returned by an inner service's future
280  regardless of  whether it succeeds or fails ([#499])
281- **util**: Added `Then` middleware and `ServiceExt::then`, for chaining another
282  future after an inner service's future completes (with a `Response` or an
283  `Error`) ([#500])
284- **util**: Added `AndThen` middleware and `ServiceExt::and_then`, for
285  chaining another future after an inner service's future completes successfully
286  ([#485])
287- **util**: Added `layer_fn`, for constructing a `Layer` from a function taking
288  a `Service` and returning a different `Service` ([#491])
289- **util**: Added `FutureService`, which implements `Service` for a
290  `Future` whose `Output` type is a `Service` ([#496])
291- **util**: Added `BoxService::layer` and `UnsyncBoxService::layer`, to make
292  constructing layers more ergonomic ([#503])
293- **layer**: Added `Layer` impl for `&Layer` ([#446])
294- **retry**: Added `Retry::get_ref`, `Retry::get_mut`, and `Retry::into_inner`
295  to access the inner service ([#463])
296- **timeout**: Added `Timeout::get_ref`, `Timeout::get_mut`, and
297  `Timeout::into_inner` to access the inner service ([#463])
298- **buffer**: Added `Clone` and `Copy` impls for `BufferLayer` (#[493])
299- Several documentation improvements ([#442], [#444], [#445], [#449], [#487],
300  [#490], [#506]])
301
302### Changed
303
304- All middleware `tower-*` crates were merged into `tower` and placed
305  behind feature flags ([#432])
306- Updated Tokio dependency to 1.0 ([#489])
307- **builder**: Make `ServiceBuilder::service` take `self` by reference rather
308  than by value ([#504])
309- **reconnect**: Return errors from `MakeService` in the response future, rather than
310  in `poll_ready`, allowing the reconnect service to be reused when a reconnect
311  fails ([#386], [#437])
312- **discover**: Changed `Discover` to be a sealed trait alias for a
313  `TryStream<Item = Change>`. `Discover` implementations are now written by
314  implementing `Stream`. ([#443])
315- **load**: Renamed the `Instrument` trait to `TrackCompletion` ([#445])
316- **load**: Renamed `NoInstrument` to `CompleteOnResponse` ([#445])
317- **balance**: Renamed `BalanceLayer` to `MakeBalanceLayer` ([#449])
318- **balance**: Renamed `BalanceMake` to `MakeBalance` ([#449])
319- **ready-cache**: Changed `ready_cache::error::Failed`'s `fmt::Debug` impl to
320  require the key type to also implement `fmt::Debug` ([#467])
321- **filter**: Changed `Filter` and `Predicate` to use a synchronous function as
322  a predicate ([#508])
323- **filter**: Renamed the previous `Filter` and `Predicate` (where `Predicate`s
324  returned a `Future`) to `AsyncFilter` and `AsyncPredicate` ([#508])
325- **filter**: `Predicate`s now take a `Request` type by value and may return a
326  new request, potentially of a different type ([#508])
327- **filter**: `Predicate`s may now return an error of any type ([#508])
328
329### Fixed
330
331- **limit**: Fixed an issue where `RateLimit` services do not reset the remaining
332  count when rate limiting ([#438], [#439])
333- **util**: Fixed a bug where `oneshot` futures panic if the service does not
334  immediately become ready ([#447])
335- **ready-cache**: Fixed `ready_cache::error::Failed` not returning inner error types
336  via `Error::source` ([#467])
337- **hedge**: Fixed an interaction with `buffer` where `buffer` slots were
338  eagerly reserved for hedge requests even if they were not sent ([#472])
339- **hedge**: Fixed the use of a fixed 10 second bound on the hedge latency
340  histogram resulting on errors with longer-lived requests. The latency
341  histogram now automatically resizes ([#484])
342- **buffer**: Fixed an issue where tasks waiting for buffer capacity were not
343  woken when a buffer is dropped, potentially resulting in a task leak ([#480])
344
345### Removed
346
347- Remove `ServiceExt::ready`.
348- **discover**: Removed `discover::stream` module, since `Discover` is now an
349  alias for `Stream` ([#443])
350- **buffer**: Removed `MakeBalance::from_rng`, which caused all balancers to use
351  the same RNG ([#497])
352
353[#432]: https://github.com/tower-rs/tower/pull/432
354[#426]: https://github.com/tower-rs/tower/pull/426
355[#435]: https://github.com/tower-rs/tower/pull/435
356[#499]: https://github.com/tower-rs/tower/pull/499
357[#386]: https://github.com/tower-rs/tower/pull/386
358[#437]: https://github.com/tower-rs/tower/pull/487
359[#438]: https://github.com/tower-rs/tower/pull/438
360[#437]: https://github.com/tower-rs/tower/pull/439
361[#443]: https://github.com/tower-rs/tower/pull/443
362[#442]: https://github.com/tower-rs/tower/pull/442
363[#444]: https://github.com/tower-rs/tower/pull/444
364[#445]: https://github.com/tower-rs/tower/pull/445
365[#446]: https://github.com/tower-rs/tower/pull/446
366[#447]: https://github.com/tower-rs/tower/pull/447
367[#449]: https://github.com/tower-rs/tower/pull/449
368[#463]: https://github.com/tower-rs/tower/pull/463
369[#396]: https://github.com/tower-rs/tower/pull/396
370[#467]: https://github.com/tower-rs/tower/pull/467
371[#472]: https://github.com/tower-rs/tower/pull/472
372[#480]: https://github.com/tower-rs/tower/pull/480
373[#484]: https://github.com/tower-rs/tower/pull/484
374[#489]: https://github.com/tower-rs/tower/pull/489
375[#497]: https://github.com/tower-rs/tower/pull/497
376[#487]: https://github.com/tower-rs/tower/pull/487
377[#493]: https://github.com/tower-rs/tower/pull/493
378[#491]: https://github.com/tower-rs/tower/pull/491
379[#495]: https://github.com/tower-rs/tower/pull/495
380[#503]: https://github.com/tower-rs/tower/pull/503
381[#504]: https://github.com/tower-rs/tower/pull/504
382[#492]: https://github.com/tower-rs/tower/pull/492
383[#500]: https://github.com/tower-rs/tower/pull/500
384[#490]: https://github.com/tower-rs/tower/pull/490
385[#506]: https://github.com/tower-rs/tower/pull/506
386[#508]: https://github.com/tower-rs/tower/pull/508
387[#485]: https://github.com/tower-rs/tower/pull/485
388
389# 0.3.1 (January 17, 2020)
390
391- Allow opting out of tracing/log (#410).
392
393# 0.3.0 (December 19, 2019)
394
395- Update all tower based crates to `0.3`.
396- Update to `tokio 0.2`
397- Update to `futures 0.3`
398
399# 0.3.0-alpha.2 (September 30, 2019)
400
401- Move to `futures-*-preview 0.3.0-alpha.19`
402- Move to `pin-project 0.4`
403
404# 0.3.0-alpha.1a (September 13, 2019)
405
406- Update `tower-buffer` to `0.3.0-alpha.1b`
407
408# 0.3.0-alpha.1 (September 11, 2019)
409
410- Move to `std::future`
411
412# 0.1.1 (July 19, 2019)
413
414- Add `ServiceBuilder::into_inner`
415
416# 0.1.0 (April 26, 2019)
417
418- Initial release
419