Trait Predicate

Source
pub trait Predicate {
    // Required method
    fn matches(&self, node: &Node<'_>) -> bool;

    // Provided methods
    fn or<T: Predicate>(self, other: T) -> Or<Self, T>
       where Self: Sized { ... }
    fn and<T: Predicate>(self, other: T) -> And<Self, T>
       where Self: Sized { ... }
    fn not(self) -> Not<Self>
       where Self: Sized { ... }
    fn child<T: Predicate>(self, other: T) -> Child<Self, T>
       where Self: Sized { ... }
    fn descendant<T: Predicate>(self, other: T) -> Descendant<Self, T>
       where Self: Sized { ... }
}
Expand description

A trait implemented by all Node matchers.

Required Methods§

Source

fn matches(&self, node: &Node<'_>) -> bool

Provided Methods§

Source

fn or<T: Predicate>(self, other: T) -> Or<Self, T>
where Self: Sized,

Source

fn and<T: Predicate>(self, other: T) -> And<Self, T>
where Self: Sized,

Source

fn not(self) -> Not<Self>
where Self: Sized,

Source

fn child<T: Predicate>(self, other: T) -> Child<Self, T>
where Self: Sized,

Source

fn descendant<T: Predicate>(self, other: T) -> Descendant<Self, T>
where Self: Sized,

Implementors§

Source§

impl Predicate for Any

Source§

impl Predicate for Comment

Source§

impl Predicate for Element

Source§

impl Predicate for Text

Source§

impl<'a> Predicate for Attr<&'a str, &'a str>

Source§

impl<'a> Predicate for Attr<&'a str, ()>

Source§

impl<'a> Predicate for Class<&'a str>

Source§

impl<'a> Predicate for Name<&'a str>

Source§

impl<A: Predicate, B: Predicate> Predicate for And<A, B>

Source§

impl<A: Predicate, B: Predicate> Predicate for Child<A, B>

Source§

impl<A: Predicate, B: Predicate> Predicate for Descendant<A, B>

Source§

impl<A: Predicate, B: Predicate> Predicate for Or<A, B>

Source§

impl<F: Fn(&Node<'_>) -> bool> Predicate for F

Matches if the function returns true.

Source§

impl<T: Predicate> Predicate for Not<T>