FilterExpr.matches
Evaluate this validated expression against candidate.
Source and package
- Qualified name
-
libtmux::query:: Filter Expr:: matches - Module
- query
- Declared in
FilterExpr- Package
- libtmux
- Source
- crates/libtmux/src/query.rs
- impl<T: Filterable> Filter
Expr <T> #[must_use] pub fn matches(&self, candidate: &T) -> bool -
Description#
Evaluation is infallible, ordered, and short-circuiting. Every text predicate first requires strict candidate UTF-8 and returns
falsefor invalid bytes, including empty exclusion. An outerSelf::not()can invert that result.Examples#
use libtmux::query::{BoolField, FilterExpressionError, Filterable};use libtmux::query::__private::{self, Predicate};struct Task(bool);struct Fields(BoolField<Task>);impl Filterable for Task {type Fields = Fields;const FILTER_TARGET: &'static str = "task";fn filter_fields() -> Self::Fields {Fields(__private::bool_field(Self::FILTER_TARGET, "done"))}fn __filter_matches(&self, predicate: &Predicate) -> bool {predicate.matches_bool(self.0)}fn __filter_validate(_: &Predicate) -> Result<(), FilterExpressionError> {Ok(())}}let expression = Task::filter_fields().0.eq(true);assert!(expression.matches(&Task(true)));- Type parameters
-
-
Tdeclared byFilterExpr<T>
-
- Parameters