From 024666509e81068a92ad3ec549445170ef73a394 Mon Sep 17 00:00:00 2001 From: axon-q Date: Thu, 14 Jun 2018 09:56:12 +0000 Subject: [PATCH] rename RequestFilter to Filter --- src/middleware/etaghasher.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/middleware/etaghasher.rs b/src/middleware/etaghasher.rs index 132ddc6b5..b68174c84 100644 --- a/src/middleware/etaghasher.rs +++ b/src/middleware/etaghasher.rs @@ -90,7 +90,7 @@ pub trait Hasher { fn hash(&mut self, input: &[u8]) -> String; } /// Can test a (request, response) pair and return `true` or `false` -pub trait RequestFilter { +pub trait Filter { /// Return `true` if ETag processing should be applied to this /// `(request, response)` pair and `false` otherwise. A `false` return /// value will immediately return the original response unchanged. @@ -103,7 +103,7 @@ impl String> Hasher for F { self(input) } } -impl, &HttpResponse) -> bool> RequestFilter for F { +impl, &HttpResponse) -> bool> Filter for F { fn filter(&self, req: &HttpRequest, res: &HttpResponse) -> bool { self(req, res) } @@ -134,7 +134,7 @@ impl Hasher for DefaultHasher { /// Returns `true` when the request method is `GET` or `HEAD` and the /// original response status is `200 OK`, and `false` otherwise. pub struct DefaultFilter; -impl RequestFilter for DefaultFilter { +impl Filter for DefaultFilter { fn filter(&self, req: &HttpRequest, res: &HttpResponse) -> bool { use http::{Method, StatusCode}; (*req.method() == Method::GET || *req.method() == Method::HEAD) @@ -154,7 +154,7 @@ pub struct EtagHasher where S: 'static, H: Hasher + 'static, - F: RequestFilter + 'static, + F: Filter + 'static, { hasher: H, filter: F, @@ -165,9 +165,9 @@ impl EtagHasher where S: 'static, H: Hasher + 'static, - F: RequestFilter + 'static, + F: Filter + 'static, { - /// Create a new middleware struct with the given Hasher and RequestFilter. + /// Create a new middleware struct with the given Hasher and Filter. pub fn new(hasher: H, filter: F) -> Self { EtagHasher { hasher, @@ -181,7 +181,7 @@ impl middleware::Middleware for EtagHasher where S: 'static, H: Hasher + 'static, - F: RequestFilter + 'static, + F: Filter + 'static, { fn response( &mut self, req: &mut HttpRequest, mut res: HttpResponse,