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:
parent
9983347392
commit
486c533989
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue