pub enum Expression {
Conditional(ConditionalExpression),
Constant(ConstantExpression),
FunctionCall(FunctionCallExpression),
MemberAccess(MemberAccessExpression),
Parameter(ParameterExpression),
Keyword(KeywordExpression),
Unary(UnaryExpression),
Binary(BinaryExpression),
}Expand description
A parsed composition expression.
Variants§
Conditional(ConditionalExpression)
Constant(ConstantExpression)
FunctionCall(FunctionCallExpression)
MemberAccess(MemberAccessExpression)
Parameter(ParameterExpression)
Keyword(KeywordExpression)
Unary(UnaryExpression)
Binary(BinaryExpression)
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn expression_type(&self) -> ExpressionType
pub fn expression_type(&self) -> ExpressionType
The kind of the node.
Sourcepub fn parse(expression: &str) -> Result<Expression, ExpressionParseException>
pub fn parse(expression: &str) -> Result<Expression, ExpressionParseException>
Parses an expression.
Sourcepub fn evaluate(
&self,
context: &ExpressionEvaluationContext<'_>,
) -> ExpressionVariant
pub fn evaluate( &self, context: &ExpressionEvaluationContext<'_>, ) -> ExpressionVariant
Evaluates the expression. Anything that cannot be evaluated (an unknown parameter, member or function, mismatched operand types) gives an invalid variant.
§Panics
Panics when the expression reads a member of this.Target and the
context has no target, or calls a function and the context has no
foreign function interface (programmer errors).
Sourcepub fn collect_references(&self, references: &mut HashSet<(String, String)>)
pub fn collect_references(&self, references: &mut HashSet<(String, String)>)
Collects the (parameter, property) pairs the expression reads.
Members of this.Target are collected with the parameter name
ExpressionKeywords::TARGET.
Sourcepub fn operator_name(t: ExpressionType) -> &'static str
pub fn operator_name(t: ExpressionType) -> &'static str
The text of an operator, or the name of the expression type for the types that are not operators.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§impl Debug for Expression
impl Debug for Expression
Source§impl Display for Expression
impl Display for Expression
Source§impl From<BinaryExpression> for Expression
impl From<BinaryExpression> for Expression
Source§fn from(value: BinaryExpression) -> Expression
fn from(value: BinaryExpression) -> Expression
Converts to this type from the input type.
Source§impl From<ConditionalExpression> for Expression
impl From<ConditionalExpression> for Expression
Source§fn from(value: ConditionalExpression) -> Expression
fn from(value: ConditionalExpression) -> Expression
Converts to this type from the input type.
Source§impl From<ConstantExpression> for Expression
impl From<ConstantExpression> for Expression
Source§fn from(value: ConstantExpression) -> Expression
fn from(value: ConstantExpression) -> Expression
Converts to this type from the input type.
Source§impl From<FunctionCallExpression> for Expression
impl From<FunctionCallExpression> for Expression
Source§fn from(value: FunctionCallExpression) -> Expression
fn from(value: FunctionCallExpression) -> Expression
Converts to this type from the input type.
Source§impl From<KeywordExpression> for Expression
impl From<KeywordExpression> for Expression
Source§fn from(value: KeywordExpression) -> Expression
fn from(value: KeywordExpression) -> Expression
Converts to this type from the input type.
Source§impl From<MemberAccessExpression> for Expression
impl From<MemberAccessExpression> for Expression
Source§fn from(value: MemberAccessExpression) -> Expression
fn from(value: MemberAccessExpression) -> Expression
Converts to this type from the input type.
Source§impl From<ParameterExpression> for Expression
impl From<ParameterExpression> for Expression
Source§fn from(value: ParameterExpression) -> Expression
fn from(value: ParameterExpression) -> Expression
Converts to this type from the input type.
Source§impl From<UnaryExpression> for Expression
impl From<UnaryExpression> for Expression
Source§fn from(value: UnaryExpression) -> Expression
fn from(value: UnaryExpression) -> Expression
Converts to this type from the input type.
Source§impl PartialEq for Expression
impl PartialEq 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 UnsafeUnpin for Expression
impl UnwindSafe for Expression
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more