Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

query.FilterExpr.matches

Rust
  • Python Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
query
Declared in
FilterExpr
Package
libtmux
Source
crates/libtmux/src/query.rs
matches ( self , candidate : &T ) → bool
method [source]
method [source]
matches

Evaluate this validated expression against candidate.

Evaluation is infallible, ordered, and short-circuiting. Every text predicate first requires strict candidate UTF-8 and returns false for invalid bytes, including empty exclusion. An outer Self::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)));

0 declared, 0 inherited

Esc

Type to search.