use super::Filter; use tower_layer::Layer; /// Conditionally dispatch requests to the inner service based on a predicate. #[derive(Debug)] pub struct FilterLayer { predicate: U, } impl FilterLayer { #[allow(missing_docs)] pub fn new(predicate: U) -> Self { FilterLayer { predicate } } } impl Layer for FilterLayer { type Service = Filter; fn layer(&self, service: S) -> Self::Service { let predicate = self.predicate.clone(); Filter::new(service, predicate) } }