pub trait PredicateVisitor {
type Error;
type Value;
// Required methods
fn visit_leaf(
&mut self,
leaf: &PredicateNode,
) -> Result<VisitOutcome<Self::Value>, Self::Error>;
fn combine_not(
&mut self,
original: &Predicate,
child: VisitOutcome<Self::Value>,
) -> Result<VisitOutcome<Self::Value>, Self::Error>;
fn combine_and(
&mut self,
original: &Predicate,
children: Vec<VisitOutcome<Self::Value>>,
) -> Result<VisitOutcome<Self::Value>, Self::Error>;
fn combine_or(
&mut self,
original: &Predicate,
children: Vec<VisitOutcome<Self::Value>>,
) -> Result<VisitOutcome<Self::Value>, Self::Error>;
// Provided methods
fn visit_predicate(
&mut self,
predicate: &Predicate,
) -> Result<VisitOutcome<Self::Value>, Self::Error> { ... }
fn visit_node(
&mut self,
node: &PredicateNode,
original: &Predicate,
) -> Result<VisitOutcome<Self::Value>, Self::Error> { ... }
}Expand description
Visitor that walks predicate trees and emits custom results plus residual predicates.
Required Associated Types§
Required Methods§
Sourcefn visit_leaf(
&mut self,
leaf: &PredicateNode,
) -> Result<VisitOutcome<Self::Value>, Self::Error>
fn visit_leaf( &mut self, leaf: &PredicateNode, ) -> Result<VisitOutcome<Self::Value>, Self::Error>
Evaluates a leaf predicate and returns its result.
Sourcefn combine_not(
&mut self,
original: &Predicate,
child: VisitOutcome<Self::Value>,
) -> Result<VisitOutcome<Self::Value>, Self::Error>
fn combine_not( &mut self, original: &Predicate, child: VisitOutcome<Self::Value>, ) -> Result<VisitOutcome<Self::Value>, Self::Error>
Combines the result of a negated child predicate.
Sourcefn combine_and(
&mut self,
original: &Predicate,
children: Vec<VisitOutcome<Self::Value>>,
) -> Result<VisitOutcome<Self::Value>, Self::Error>
fn combine_and( &mut self, original: &Predicate, children: Vec<VisitOutcome<Self::Value>>, ) -> Result<VisitOutcome<Self::Value>, Self::Error>
Combines an AND clause from the supplied child results.
Sourcefn combine_or(
&mut self,
original: &Predicate,
children: Vec<VisitOutcome<Self::Value>>,
) -> Result<VisitOutcome<Self::Value>, Self::Error>
fn combine_or( &mut self, original: &Predicate, children: Vec<VisitOutcome<Self::Value>>, ) -> Result<VisitOutcome<Self::Value>, Self::Error>
Combines an OR clause from the supplied child results.
Provided Methods§
Sourcefn visit_predicate(
&mut self,
predicate: &Predicate,
) -> Result<VisitOutcome<Self::Value>, Self::Error>
fn visit_predicate( &mut self, predicate: &Predicate, ) -> Result<VisitOutcome<Self::Value>, Self::Error>
Visits the supplied predicate by walking the expression tree.
Sourcefn visit_node(
&mut self,
node: &PredicateNode,
original: &Predicate,
) -> Result<VisitOutcome<Self::Value>, Self::Error>
fn visit_node( &mut self, node: &PredicateNode, original: &Predicate, ) -> Result<VisitOutcome<Self::Value>, Self::Error>
Internal helper that evaluates a predicate node recursively.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".