pub enum Expression {
Show 16 variants
Term(Term),
Invocation(Box<Expression>, Invocation),
Indexer(Box<Expression>, Box<Expression>),
Polarity(char, Box<Expression>),
Multiplicative(Box<Expression>, String, Box<Expression>),
Additive(Box<Expression>, String, Box<Expression>),
Type(Box<Expression>, String, TypeSpecifier),
Union(Box<Expression>, Box<Expression>),
Inequality(Box<Expression>, String, Box<Expression>),
Equality(Box<Expression>, String, Box<Expression>),
Membership(Box<Expression>, String, Box<Expression>),
And(Box<Expression>, Box<Expression>),
Or(Box<Expression>, String, Box<Expression>),
Implies(Box<Expression>, Box<Expression>),
Lambda(Option<String>, Box<Expression>),
InstanceSelector(String, Vec<(String, Box<Expression>)>),
}Expand description
Represents a FHIRPath expression
This enum represents the different kinds of expressions that can appear in a FHIRPath expression tree. It forms the core of the abstract syntax tree (AST) produced by the parser. Each variant corresponds to a different type of expression in the FHIRPath language, including basic terms, operators, and function invocations.
The Expression tree is built during parsing and later evaluated by the evaluator to produce a result value. The structure preserves operator precedence and expression nesting as specified in the FHIRPath grammar.
Variants§
Term(Term)
A basic term (literal, invocation, etc.)
Invocation(Box<Expression>, Invocation)
A method or function invocation on an expression
(e.g., Patient.name.given.first())
Indexer(Box<Expression>, Box<Expression>)
An indexer expression (e.g., Patient.name[0])
Polarity(char, Box<Expression>)
A unary polarity expression (+ or -)
(e.g., -5 or +value)
Multiplicative(Box<Expression>, String, Box<Expression>)
A multiplicative expression (*, /, div, mod)
(e.g., value * 2 or amount div 10)
Additive(Box<Expression>, String, Box<Expression>)
An additive expression (+ or -)
(e.g., value + 5 or total - tax)
Type(Box<Expression>, String, TypeSpecifier)
A type operation (is, as)
(e.g., value is Integer or patient as Patient)
Union(Box<Expression>, Box<Expression>)
A union operation (|)
(e.g., Patient.name | Patient.address)
Inequality(Box<Expression>, String, Box<Expression>)
An inequality comparison (<, <=, >, >=)
(e.g., value > 5 or date <= today())
Equality(Box<Expression>, String, Box<Expression>)
An equality comparison (=, !=, , !)
(e.g., name = 'John' or birthDate ~ @2020)
Membership(Box<Expression>, String, Box<Expression>)
A membership test (in, contains)
(e.g., 'John' in Patient.name.given or Patient.name contains 'John')
And(Box<Expression>, Box<Expression>)
A logical AND operation
(e.g., value > 5 and value < 10)
Or(Box<Expression>, String, Box<Expression>)
A logical OR or XOR operation
(e.g., status = 'active' or status = 'pending')
Implies(Box<Expression>, Box<Expression>)
A logical IMPLIES operation
(e.g., exists() implies value > 0)
Lambda(Option<String>, Box<Expression>)
A lambda expression with optional identifier
(e.g., item => item.value > 10)
InstanceSelector(String, Vec<(String, Box<Expression>)>)
An instance selector expression
(e.g., Quantity { value: 5, unit: 'mg' })
Contains the type name and a list of field name/expression pairs.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 (const: unstable) · 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 PartialEq for Expression
impl PartialEq for Expression
Source§fn eq(&self, other: &Expression) -> bool
fn eq(&self, other: &Expression) -> bool
self and other values to be equal, and is used by ==.