Skip to main content

Evaluator

Struct Evaluator 

Source
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>

Source

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.

Source

pub fn evaluate(&self, node: &Node) -> bool

Evaluate to a boolean condition result (JS evaluateCondition).

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.