# query.Matcher.matches

- **Module:** query
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/84de9258a07d10bdd5f6da01b016a9ae06fe1210/crates/libtmux/src/query.rs#L427
- **Page:** https://libtmux.org/en/rs/latest/reference/query-matcher-matches/

```
pub trait Matcher<T>
fn matches(&self, candidate: &T) -> bool;
```

Return whether `candidate` matches this predicate.

## Examples

```rust
use libtmux::query::Matcher;

let is_positive = |candidate: &i32| *candidate > 0;
assert!(is_positive.matches(&1));
assert!(!is_positive.matches(&-1));
```

## Type parameters

- [`T`](/en/rs/latest/reference/query-matcher/#query.Matcher.type-parameter.T), declared by [`Matcher<T>`](/en/rs/latest/reference/query-matcher/)

## Parameters

- `&self`
- `candidate` (`&T`)
