1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 01:51:23 +02:00

remove box from predicates

This commit is contained in:
Nikolay Kim
2017-12-20 13:23:50 -08:00
parent 813b56ebe5
commit 79f047f5be
5 changed files with 99 additions and 51 deletions

View File

@ -506,9 +506,8 @@ fn main() {
Application::new()
.resource("/index.html", |r|
r.route()
.p(Box::new(ContentTypeHeader))
.f(|req| HTTPOk))
.finish();
.p(ContentTypeHeader)
.h(HTTPOk));
}
```
@ -545,14 +544,14 @@ fn main() {
predicates match. i.e:
```rust,ignore
pred::Any(vec![pred::Get(), pred::Post()])
pred::Any(pred::Get()).or(pred::Post())
```
`All` predicate accept list of predicates and matches if all of the supplied
predicates match. i.e:
```rust,ignore
pred::All(vec![pred::Get(), pred::Header("content-type", "plain/text")])
pred::All(pred::Get()).and(pred::Header("content-type", "plain/text"))
```
## Changing the default Not Found response