tower: Reexport all layers and add layer::util mod (#224)

* tower: Reexport all layers and add layer::util mod

* Fix crate names and layerext
This commit is contained in:
Lucio Franco 2019-04-03 12:12:11 -04:00 committed by GitHub
parent 9983347392
commit 486c533989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 5 deletions

View File

@ -1,9 +1,19 @@
//! A collection of `Layer` based tower services
pub use tower_layer::Layer;
// TODO: Should this be re-exported?
pub use tower_util::layer::Chain;
pub use tower_util::layer::Identity;
pub use buffer::BufferLayer;
pub use filter::FilterLayer;
pub use in_flight_limit::InFlightLimitLayer;
pub use load_shed::LoadShedLayer;
pub use rate_limit::RateLimitLayer;
pub use retry::RetryLayer;
pub use timeout::TimeoutLayer;
pub mod util {
pub use tower_util::layer::Chain;
pub use tower_util::layer::Identity;
}
/// An extension trait for `Layer`'s that provides a variety of convenient
/// adapters.
@ -12,12 +22,12 @@ pub trait LayerExt<S, Request>: Layer<S, Request> {
/// `middleware` to services being wrapped.
///
/// This defines a middleware stack.
fn chain<T>(self, middleware: T) -> Chain<Self, T>
fn chain<T>(self, middleware: T) -> util::Chain<Self, T>
where
T: Layer<Self::Service, Request>,
Self: Sized,
{
Chain::new(self, middleware)
util::Chain::new(self, middleware)
}
}