pub enum Expression {
Field(FieldNode),
LastField(LastFieldNode),
And(AndNode),
Or(OrNode),
Not(NotNode),
Op(OpNode),
Literal(LiteralNode),
Function(FunctionNode),
Iif(IifNode),
List(ListNode),
}Expand description
An expression that can be inspected or evaluated
Variants§
Field(FieldNode)
A node representing a reference to a field
E.g. MlsStatus
LastField(LastFieldNode)
A node representing a reference to a field from the previous value
E.g. LAST MlsStatus
And(AndNode)
A node representing the logical conjunction of two or more expressions
E.g. A .AND. B
Or(OrNode)
A node representing the logical disjunction of two or more expressions
E.g. A .OR. B
Not(NotNode)
A node representing the logical negation of an expression
E.g. .NOT. A
Op(OpNode)
A node representing a binary operation
E.g. A + B
Literal(LiteralNode)
A node representing a literal value
E.g. .TRUE.
Function(FunctionNode)
A node representing a function call
E.g. SUBSTR('A', 1, 2)
Iif(IifNode)
A node representing the special IIF conditional syntax
E.g. IIF(A, B, C)
List(ListNode)
A node representing a list of items
E.g. (1, 2, 3)
Implementations§
Source§impl Expression
impl Expression
Source§impl Expression
impl Expression
Source§impl Expression
impl Expression
Sourcepub fn as_field(&self) -> Option<&FieldNode>
pub fn as_field(&self) -> Option<&FieldNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_field_mut(&mut self) -> Option<&mut FieldNode>
pub fn as_field_mut(&mut self) -> Option<&mut FieldNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_last_field(&self) -> Option<&LastFieldNode>
pub fn as_last_field(&self) -> Option<&LastFieldNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_last_field_mut(&mut self) -> Option<&mut LastFieldNode>
pub fn as_last_field_mut(&mut self) -> Option<&mut LastFieldNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_and(&self) -> Option<&AndNode>
pub fn as_and(&self) -> Option<&AndNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_and_mut(&mut self) -> Option<&mut AndNode>
pub fn as_and_mut(&mut self) -> Option<&mut AndNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_or(&self) -> Option<&OrNode>
pub fn as_or(&self) -> Option<&OrNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_or_mut(&mut self) -> Option<&mut OrNode>
pub fn as_or_mut(&mut self) -> Option<&mut OrNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_not(&self) -> Option<&NotNode>
pub fn as_not(&self) -> Option<&NotNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_not_mut(&mut self) -> Option<&mut NotNode>
pub fn as_not_mut(&mut self) -> Option<&mut NotNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_op(&self) -> Option<&OpNode>
pub fn as_op(&self) -> Option<&OpNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_op_mut(&mut self) -> Option<&mut OpNode>
pub fn as_op_mut(&mut self) -> Option<&mut OpNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_literal(&self) -> Option<&LiteralNode>
pub fn as_literal(&self) -> Option<&LiteralNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_literal_mut(&mut self) -> Option<&mut LiteralNode>
pub fn as_literal_mut(&mut self) -> Option<&mut LiteralNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_function(&self) -> Option<&FunctionNode>
pub fn as_function(&self) -> Option<&FunctionNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_function_mut(&mut self) -> Option<&mut FunctionNode>
pub fn as_function_mut(&mut self) -> Option<&mut FunctionNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_iif(&self) -> Option<&IifNode>
pub fn as_iif(&self) -> Option<&IifNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_iif_mut(&mut self) -> Option<&mut IifNode>
pub fn as_iif_mut(&mut self) -> Option<&mut IifNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Sourcepub fn as_list(&self) -> Option<&ListNode>
pub fn as_list(&self) -> Option<&ListNode>
If the Expression is a X, returns a reference to the associated Y. Returns None
otherwise.
Sourcepub fn as_list_mut(&mut self) -> Option<&mut ListNode>
pub fn as_list_mut(&mut self) -> Option<&mut ListNode>
If the Expression is a X, returns a mutable reference to the associated Y. Returns
None otherwise.
Source§impl Expression
impl Expression
Sourcepub fn apply<'expr, 'val, T>(
&'expr self,
context: EvaluateContext<'_, 'val, T>,
) -> Result<Cow<'val, Value>, Error>where
'expr: 'val,
pub fn apply<'expr, 'val, T>(
&'expr self,
context: EvaluateContext<'_, 'val, T>,
) -> Result<Cow<'val, Value>, Error>where
'expr: 'val,
Run the expression to completion and return the result
Sourcepub fn apply_with_locals<'expr, 'val, T>(
&'expr self,
context: EvaluateContext<'_, 'val, T>,
locals: &BTreeMap<&'expr str, Cow<'val, Value>>,
) -> Result<Cow<'val, Value>, Error>where
'expr: 'val,
pub fn apply_with_locals<'expr, 'val, T>(
&'expr self,
context: EvaluateContext<'_, 'val, T>,
locals: &BTreeMap<&'expr str, Cow<'val, Value>>,
) -> Result<Cow<'val, Value>, Error>where
'expr: 'val,
Run the expression to completion and return the result
Locals can be used to augment or override the provided JSON values.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl From<AndNode> for Expression
impl From<AndNode> for Expression
Source§fn from(node: AndNode) -> Expression
fn from(node: AndNode) -> Expression
Source§impl From<FieldNode> for Expression
impl From<FieldNode> for Expression
Source§fn from(node: FieldNode) -> Expression
fn from(node: FieldNode) -> Expression
Source§impl From<FunctionNode> for Expression
impl From<FunctionNode> for Expression
Source§fn from(node: FunctionNode) -> Expression
fn from(node: FunctionNode) -> Expression
Source§impl From<IifNode> for Expression
impl From<IifNode> for Expression
Source§fn from(node: IifNode) -> Expression
fn from(node: IifNode) -> Expression
Source§impl From<LastFieldNode> for Expression
impl From<LastFieldNode> for Expression
Source§fn from(node: LastFieldNode) -> Expression
fn from(node: LastFieldNode) -> Expression
Source§impl From<ListNode> for Expression
impl From<ListNode> for Expression
Source§fn from(node: ListNode) -> Expression
fn from(node: ListNode) -> Expression
Source§impl From<LiteralNode> for Expression
impl From<LiteralNode> for Expression
Source§fn from(node: LiteralNode) -> Expression
fn from(node: LiteralNode) -> Expression
Source§impl From<NotNode> for Expression
impl From<NotNode> for Expression
Source§fn from(node: NotNode) -> Expression
fn from(node: NotNode) -> Expression
Source§impl From<OpNode> for Expression
impl From<OpNode> for Expression
Source§fn from(node: OpNode) -> Expression
fn from(node: OpNode) -> Expression
Source§impl From<OrNode> for Expression
impl From<OrNode> for Expression
Source§fn from(node: OrNode) -> Expression
fn from(node: OrNode) -> Expression
Source§impl FromStr for Expression
impl FromStr for Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
impl Eq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)