mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 08:57:00 +02:00
rename .p to a .filter
This commit is contained in:
12
src/route.rs
12
src/route.rs
@@ -65,18 +65,24 @@ impl<S: 'static> Route<S> {
|
||||
/// Application::new()
|
||||
/// .resource("/path", |r|
|
||||
/// r.route()
|
||||
/// .p(pred::Get())
|
||||
/// .p(pred::Header("content-type", "text/plain"))
|
||||
/// .filter(pred::Get())
|
||||
/// .filter(pred::Header("content-type", "text/plain"))
|
||||
/// .f(|req| HTTPOk)
|
||||
/// )
|
||||
/// # .finish();
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn p<T: Predicate<S> + 'static>(&mut self, p: T) -> &mut Self {
|
||||
pub fn filter<T: Predicate<S> + 'static>(&mut self, p: T) -> &mut Self {
|
||||
self.preds.push(Box::new(p));
|
||||
self
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since="0.4.1", note="please use `.filter()` instead")]
|
||||
pub fn p<T: Predicate<S> + 'static>(&mut self, p: T) -> &mut Self {
|
||||
self.filter(p)
|
||||
}
|
||||
|
||||
/// Set handler object. Usually call to this method is last call
|
||||
/// during route configuration, because it does not return reference to self.
|
||||
pub fn h<H: Handler<S>>(&mut self, handler: H) {
|
||||
|
Reference in New Issue
Block a user