pub struct Evaluator<'a> { /* private fields */ }Expand description
AST evaluator bound to a form-data tree and the current field path.
Implementations§
Source§impl<'a> Evaluator<'a>
impl<'a> Evaluator<'a>
Sourcepub fn new(
form_data: &'a Value,
current_path: &'a [String],
row_keys: &'a [usize],
) -> Self
pub fn new( form_data: &'a Value, current_path: &'a [String], row_keys: &'a [usize], ) -> Self
Build an evaluator over the full form data, the path of the field carrying the condition (including the field name itself) and the positions of the row keys in that path.
Sourcepub fn evaluate(&self, node: &Node) -> bool
pub fn evaluate(&self, node: &Node) -> bool
Evaluate to a boolean condition result (JS evaluateCondition).
Sourcepub fn evaluate_value(&self, node: &Node) -> Value
pub fn evaluate_value(&self, node: &Node) -> Value
Evaluate to a value (JS evaluateExpressionValue). A ternary returns its
chosen branch’s RAW value; every other node returns its boolean condition
result (the shared fixture’s value for non-ternary mirrors truthy).
Auto Trait Implementations§
impl<'a> Freeze for Evaluator<'a>
impl<'a> RefUnwindSafe for Evaluator<'a>
impl<'a> Send for Evaluator<'a>
impl<'a> Sync for Evaluator<'a>
impl<'a> Unpin for Evaluator<'a>
impl<'a> UnsafeUnpin for Evaluator<'a>
impl<'a> UnwindSafe for Evaluator<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more