38 Commits

Author SHA1 Message Date
David Barsky
646804d77e
chore: prepare to release tower-0.5.0, tower-layer-0.3.3, tower-service-0.3.3, and tower-test-0.4.1 (#781) 2024-08-02 15:21:30 -04:00
Daniél Kerkmann
89ac74f320
feat: Make new functions const when possible (#760)
* feat: Make new functions const when possible

The main reason was to allow to initialize the RateLimitLayer in a const context.
So why not making ever new function const (wherever it's possible). :P

* Change the assert to use an MSRV-compatible function.

---------

Co-authored-by: Toby Lawrence <tobz@users.noreply.github.com>
2024-07-20 13:18:29 -04:00
Misha Zharov
0604f20c48
Bump version numbers (#729) 2023-04-11 18:55:52 +02:00
Jonas Platte
87fa8ef782
layer: Implement Layer for tuples of up to 16 elements (#694) 2022-10-04 18:54:39 +00:00
Folyd
6d34340f1e
chore: fix Service doc links in tower-layer (#579)
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
2022-08-15 13:13:11 -04:00
Bruno
34d6e7befa
fix: broken Service link (#659) 2022-04-07 13:33:15 -04:00
Jonas Platte
d0d8707ac0
Fix sometimes-unused dependencies (#603)
`tower` currently has required dependencies that may not be used
unless certain features are enabled.

This change updates `tower` to make these dependencies optional.

Furthermore, this change removes use of `html_root_url`, which is no
longer recommended (https://github.com/rust-lang/api-guidelines/pull/230),
and updates the documented release instructions.
2022-01-17 15:25:07 -08:00
Oliver Gould
b20b3cbd57
Assert that no unsafe code is used in tower (#621)
The tower crates do not include any `unsafe` code, but tools like
[`cargo-geiger`][cg] can't necessarily detect that. This change adds a
stronger assertion at the top of each crate with a
`#![forbid(unsafe_code)]` directive to assert that no unsafe code is
used in the crate. This also serves as a more obvious obstacle to
introducing unsafe code in future changes.

[cg]: https://github.com/rust-secure-code/cargo-geiger
2021-11-24 15:26:16 -08:00
David Pedersen
4d80f7ed90
builder,util: add convenience methods for boxing services (#616)
* builder,util: add convenience methods for boxing services

This adds a couple of new methods to `ServiceBuilder` and `ServiceExt`:

- `ServiceBuilder::boxed`
- `ServiceExt::boxed`
- `ServiceBuilder::clone_boxed`
- `ServiceExt::clone_boxed`

They apply `BoxService::layer` and `CloneBoxService::layer`
respectively.

* fix doc links

* add missing `cfg`s

* Update tower/CHANGELOG.md

Co-authored-by: Eliza Weisman <eliza@buoyant.io>

* Apply suggestions from code review

Co-authored-by: Eliza Weisman <eliza@buoyant.io>

* not sure why rustdoc cannot infer these

* line breaks

* trailing whitespace

* make docs a bit more consistent

* fix doc links

* update tokio

* don't pull in old version of tower

* Don't run `cargo deny check bans` as it hangs

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2021-11-18 13:56:19 +01:00
David Pedersen
1c9631d7b3
chore: Bump MSRV to 1.46 (#605)
* Actually check MSCV on CI

* check broken_intra_doc_links on CI

* clean up CI

* fix other crates

* bump MSRV to 1.42 because of tracing-core

* attempt to fix http not working on 1.42

* use `--workspace` instead of `--all`

`--all` is deprecated

* make tower-service build on 1.42

* force http version 0.2.4

* actually msrv is 1.46 because of tokio

* fix running `cargo fmt`

* clean up

* also run tests on 1.46

* ignore rustsec in time
2021-10-19 16:28:55 +02:00
Michael-J-Ward
ee131aaf46
Migrate to pin project lite (#595)
* REMOVE ME updates peak_wema test to pass

* adds pin_project_lite dependency

* uses pin_project_lite for load::Constant

* uses pin_project_lite for load::PencingRequestsDiscover

* uses pin_project_lite for load::PeakEwma

* uses pin_project_lite for load::Completion

* uses pin_project_lite for tests::support::IntoStream

Turns IntoStream into a regular struct because pin_project_lite does not and will support tuple structs.

416be96f77/src/lib.rs (L401-L408)

* refactors opaque_future into a regular struct

This enables migration to pin_project_lite, which does not and will not support tuple structs
416be96f77/src/lib.rs (L401-L408)

* migrates opaque_future to use pin_project_lite

* removes tuple variant from load_shed::ResponseState enum

* migrates load_shed::future to pin_project_lite

* removes tuple variant from filter::future::State

* migrates filter::future to pin_project_lite

Note: the doc comment on AsyncResponseFuture::service was also reduced to a regular comment.

This is a known limitation of pin_project_lite that the they have labeled as "help wanted".
https://github.com/taiki-e/pin-project-lite/issues/3#issuecomment-745194112

* migrates retry::Retry to pin_project_lite

* refactors retry::future::State to enable pin_project_lite

pin_project_lite has the current limitation of nto supporting doc comments
https://github.com/taiki-e/pin-project-lite/issues/3#issuecomment-745194112

pin_project_lite does not and will not support tuple variants
416be96f77/src/lib.rs (L401-L408)

* migrates retry::future to pin_project_lite

* migrates spawn_ready::make to pin_project_lite

* refactors buffer::future::ResponseState to allow pin_project_lite

* migrates buffer::future to pin_project_lite

* refactors util::AndThenFuture to allow pin_project_lite

* migrates util::AndThenFuture to pin_project_lite

* migrates hedge::Future to pin_project_lite

* migrates hedge::select::ResponseFuture to pin_project_lite

* refactors hedge::delay enum for pin_project_lite

* refactors reconnect::future enum for pin_project_lite

* refactors oneshot::State enum for pin_project_lite

* migrates util::oneshot to pin_project_lite

* migrates reconnect::future to pin_project_lite

* migrates hedge::delay to pin_project_lite

* migrates hedge::latency to pin_project_lite

* migrates discover::list to pin_project_lite

* migrates timeout::future to pin_project_lite

* migrates balance::pool to pin_project_lite

* migrates balance::p2c::make to pin_project_lite

* migrates balance::p2c::service to pin_project_lite

* migrates call_all::ordered to pin_project_lite

* migrates call_all::common to pin_project_lite

* migrates call_all::unordered to pin_project_lite

* migrates util::optional::future to pin_project_lite

* migrates limit::concurrency::future to pin_project_lite

* migrates tower-balance example to pin_project_lite

* applies cargo fmt

* migrates tower-test to pin_project_lite

* fixes cargo hack check

peak_wma and pending_requests will now properly compile without the "discover" feature enabled.

* fixes lint rename warning on nightly

broken_intra_doc_links has been renamed to rustdoc::broken_intra_doc_links

* migrates buffer::Worker to pin_project_lite

pin_project_lite does support PinnedDrop
https://github.com/taiki-e/pin-project-lite/pull/25/files

However, it does not support generic trait bounds on the PinnedDrop impl.

To workaround this, I removed the T::Error bound from the Worker struct definition,
and moved `close_semaphore` to a a new impl without that trait bound.

* fixes abort_on_drop test

This test was also failing on master.

* applies cargo fmt
2021-07-28 13:48:47 -04:00
Folyd
1467321fab
chore: convert rest doc-links to intra-doc links (#578) 2021-04-21 13:02:58 +02:00
David Pedersen
0226ef0f4c
Make combinators implement Debug in more cases (#552)
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2021-01-27 23:47:04 +01:00
Eliza Weisman
1270d691d2
chore: improve README docs, add links (#527)
This branch updates the READMEs for all Tower crates.

I've added the lib.rs docs to the `tower` crate's README, and added
crates.io, docs.rs, and updated CI badges to all the crates READMEs.
Since we no longer use Azure Pipelines for CI or Gitter for chat, I've
removed those badges and replaced them with GitHub Actions and Discord
badges, respectively.

I also fixed a typo in the `tower` lib.rs docs that was breaking some of the
RustDoc links, since I noticed it after copying those docs into the README.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-01-13 10:47:42 -08:00
David Pedersen
d25589d3a6
Fix all the docs links (#515)
* Fix docs links

* Add `#![deny(broken_intra_doc_links)]` to all crates

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2021-01-11 11:44:50 -05:00
Eliza Weisman
44ad621c56
layer: prepare to release v0.3.1 (#513)
* layer: prepare to release v0.3.1

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* whitespace
2021-01-07 15:05:45 -08:00
Eliza Weisman
fdd66e5305
docs pass (#490)
This branch makes the following changes:

* New `lib.rs` docs for `tower`, which should hopefully provide a
  better explanation of Tower's core abstractions & their
  relationships
* Nicer docs for `ServiceBuilder`
* Added `#[doc(cfg(...))]` attributes for feature flagged APIs
* Example improvements
* Fixing a bunch of broken intra-rustdoc links

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-01-04 13:52:23 -08:00
David Pedersen
f76fe9f38f
util: add layer_fn (#491)
Resolves #267

I went with `layer_fn` over `layer::from_fn` because changing
`service_fn` would be a breaking change. But I don't mind changing it if
you think thats more appropriate 😊 

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-12-29 10:33:31 -08:00
George Hahn
704bfa819e
layer: fix+improve doc links (#487)
- Fixes a link to the `Service` trait on the `tower_layer` module page.
  ([current page](https://docs.rs/tower-layer/0.3.0/tower_layer/index.html))
- Adds a link to `Service` on the `Layer` trait page.
  ([current page](https://docs.rs/tower-layer/0.3.0/tower_layer/trait.Layer.html))

These changes use old style links - intra-rustdoc links won't work
here because `tower`/`tower_service` aren't referenced by this crate.
2020-12-28 15:07:01 -08:00
Steven Fackler
82e578b5b0
Impl Layer for &Layer (#446) 2020-04-21 17:11:27 -04:00
Lucio Franco
85b657bf93
Remove path deps for tower-service (#441) 2020-04-17 14:00:38 -04:00
David Barsky
45e311c2f2 layer: Prepare 0.3.0 Release (#372)
* layer: prepare 0.3.0 release

* fmt

* Update tower-layer/src/lib.rs
2019-11-29 16:09:47 -05:00
Jon Gjengset
2653f70884 Bumps for 0.3.0-alpha.2 (#355)
* Bump all to futures-* alpha.19

* Prepare for alpha.2 release

* Make tower-service also a path dep

* Use new tokio alpha
2019-09-30 18:56:26 -04:00
Jon Gjengset
6baf381879
Consistently apply deny/warn rules (#352)
This makes all tower subcrates have the following lints as warn (rather
than allow): `missing_docs`, `rust_2018_idioms`, `unreachable_pub`, and
`missing_debug_implementations`. In addition, it consistently applies
`deny(warning)` *only* under CI so that deprecations and macro changes in minor
version bumps in dependencies will never cause `tower` crates to stop
compiling, and so that tests can be run even if not all warnings have been
dealt with. See also https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md

Note that `tower-reconnect` has the `missing_docs` lint disabled for now
since it contained _no_ documentation previously. Also note that this
patch does not add documentation to the various `new` methods, as they
are considered self-explanatory. They are instead marked as
`#[allow(missing_docs)]`.
2019-09-23 17:28:14 -04:00
Taiki Endo
5a561b7776 layer: remove unused dependencies (#351) 2019-09-23 09:54:08 -04:00
Lucio Franco
83752ab6c2
layer: Add date to changelog 2019-09-11 14:49:23 -04:00
Lucio Franco
fb124a14f0
Pin all the alpha based dependencies (#339)
Signed-off-by: Lucio Franco <luciofranco14@gmail.com>
2019-09-11 13:57:27 -04:00
Jon Gjengset
db116d1937
Update tower-layer to std::future (#322)
This bumps tower-layer to 0.3.0-alpha.1
2019-09-07 00:22:18 -04:00
Carl Lerche
716bafd922
chore: fix small errors in Cargo files 2019-04-26 22:31:07 -07:00
Carl Lerche
14f4259518
Prepare release (#273)
The following crates are to be released:

- tower
- tower-buffer
- tower-discover
- tower-layer
- tower-limit
- tower-load-shed
- tower-retry
- tower-service
- tower-test
- tower-timeout
- tower-util
2019-04-26 21:31:25 -07:00
Carl Lerche
07baf63048 Remove bounds of Service from Layer 2019-04-22 13:34:38 -07:00
David Barsky
17860191d7 Move Tower to 2018 Edition (#238) 2019-04-08 20:11:09 -07:00
Carl Lerche
019129829c
Move layer::{LayerExt, Chain, Identity} (#216)
- `tower-layer` util types are now in `tower-util`.
- `LayerExt` is now in `tower`.

This sets the stage for adding layer specific extension fns.
2019-03-29 14:28:06 -07:00
Lucio Franco
476f085c89
Introduce the ServiceBuilder (#175)
The `ServiceBuilder` composes layers together and produces either a `MakeService` or a `Service` wrapped by those layers.
2019-03-26 10:14:42 -04:00
Lucio Franco
0e70f1320e
layer: Add an identity layer (#195)
Tied to #175
2019-03-24 16:53:09 -04:00
Carl Lerche
bdcce9677b
depend on tower-service from crates.io (#186) 2019-03-06 13:38:58 -08:00
Lucio Franco
0a234af4ba layer: Fix util feature and add chain try support (#174) 2019-02-28 14:34:00 -08:00
Lucio Franco
c5d70481bd
layer: Add tower-layer and the Layer trait (#163)
This change introduces the new `tower-layer` crate and the foundational `Layer` trait to go along with it. This trait allows one to easily compose a set of `Service`s that take an inner service. These services only modify the request/response. This also provides the `Layer` implementation for many of the tower crates.
2019-02-27 15:28:42 -05:00