pub enum Conditional {
Ternary(LogicalOr, Box<Expression>, Box<Conditional>),
Primary(Box<Primary>),
}Expand description
A conditional expression node in the abstract syntax tree.
Represents a ternary conditional expression (condition ? true_expr : false_expr)
or a lower-precedence expression that has been flattened in the AST.
The enum uses AST flattening optimization where each expression type includes variants for all lower-precedence expression types. This allows efficient evaluation without deep recursion.
§Variants
§Ternary(LogicalOr, Box<Expression>, Box<Conditional>)
Represents a ternary conditional operation with:
condition: The condition expression (must evaluate to a boolean or truthy value)true_expr: The expression to evaluate if condition is truthyfalse_expr: The expression to evaluate if condition is falsy
§Primary(Box<Primary>)
Represents a flattened AST node containing a lower-precedence expression. This variant is used when no ternary operator is present in the expression.
Variants§
Ternary(LogicalOr, Box<Expression>, Box<Conditional>)
Primary(Box<Primary>)
Primary flattened AST optimization
Trait Implementations§
Source§impl Clone for Conditional
impl Clone for Conditional
Source§fn clone(&self) -> Conditional
fn clone(&self) -> Conditional
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Conditional
impl Debug for Conditional
Source§impl Display for Conditional
impl Display for Conditional
Source§impl ExpressionLike for Conditional
impl ExpressionLike for Conditional
Source§fn evaluate(&self, context: &mut dyn ContextLike) -> Result<Value>
fn evaluate(&self, context: &mut dyn ContextLike) -> Result<Value>
Evaluate the expression within the given context. Read more
Source§fn to_sanitized(&self) -> String
fn to_sanitized(&self) -> String
Convert this expression to a sanitized string representation. Read more
Source§fn to_formula(&self) -> String
fn to_formula(&self) -> String
Convert this expression to a formula string representation. Read more
Source§impl PartialEq for Conditional
impl PartialEq for Conditional
impl StructuralPartialEq for Conditional
Auto Trait Implementations§
impl Freeze for Conditional
impl RefUnwindSafe for Conditional
impl Send for Conditional
impl Sync for Conditional
impl Unpin for Conditional
impl UnwindSafe for Conditional
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.