# actix_web::pred::Predicate - Rust
API documentation for the Rust `Predicate` trait in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, Predicate

# [−] [src] Trait actix_web::pred::Predicate

    pub trait Predicate<S> {
        fn check(&self, _: &Request, _: &S) -> bool;
    }

Trait defines resource route predicate. Predicate can modify request object. It is also possible to to store extra attributes on request by using `Extensions` container, Extensions container available via `HttpRequest::extensions()` method.

## Required Methods

### `fn check(&self, _: &Request, _: &S) -> bool`

Check if request matches predicate

## Implementors

###

`impl<S: 'static> Predicate<S> for AllPredicate<S>`

[src]

####

`fn check(&self, req: &Request, state: &S) -> bool`

[src]

###

`impl<S: 'static> Predicate<S> for AnyPredicate<S>`

[src]

####

`fn check(&self, req: &Request, state: &S) -> bool`

[src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)