pub enum LogicalOr {
Or(Box<LogicalOr>, LogicalAnd),
Primary(Box<Primary>),
}Expand description
A logical OR expression node in the abstract syntax tree.
Represents a logical OR operation (| or ||) or a lower-precedence
expression that has been flattened in the AST. This enum follows the
recursive descent parsing pattern used throughout the AIMX expression grammar.
§AST Structure
The LogicalOr enum forms part of the recursive AST structure where:
Ornodes represent binary OR operationsPrimarynodes represent flattened expressions from lower precedence levels
§Variants
§Or(Box<LogicalOr>, LogicalAnd)
Represents a binary logical OR operation. The left operand is another
LogicalOr expression (allowing chaining), and the right operand is
a LogicalAnd expression (higher precedence than OR operations).
§Primary(Box<Primary>)
Represents expressions that don’t contain logical OR operations. This variant is used for AST flattening optimization.
§Examples
use aimx::expressions::{
logical::LogicalOr,
logical::LogicalAnd,
primary::Primary,
};
use aimx::Literal;
// Represents the expression: true | false
let or_expr = LogicalOr::Or(
Box::new(LogicalOr::Primary(Box::new(Primary::Literal(Literal::Bool(true))))),
LogicalAnd::Primary(Box::new(Primary::Literal(Literal::Bool(false))))
);§Evaluation
When evaluated, LogicalOr expressions:
- Require boolean operands for OR operations
- Return
trueif at least one operand evaluates totrue - Provide detailed error messages for type mismatches
- Support short-circuit evaluation (right operand not evaluated if left is
true)
§See Also
LogicalAnd- Logical AND expressionsPrimary- Base expression types
Variants§
Trait Implementations§
Source§impl ExpressionLike for LogicalOr
impl ExpressionLike for LogicalOr
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
impl StructuralPartialEq for LogicalOr
Auto Trait Implementations§
impl Freeze for LogicalOr
impl RefUnwindSafe for LogicalOr
impl Send for LogicalOr
impl Sync for LogicalOr
impl Unpin for LogicalOr
impl UnwindSafe for LogicalOr
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.