pub enum LogicalAnd {
And(Box<LogicalAnd>, Equality),
Primary(Box<Primary>),
}Expand description
A logical AND expression node in the abstract syntax tree.
Represents a logical AND 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 LogicalAnd enum forms part of the recursive AST structure where:
Andnodes represent binary AND operationsPrimarynodes represent flattened expressions from lower precedence levels
§Variants
§And(Box<LogicalAnd>, Equality)
Represents a binary logical AND operation. The left operand is another
LogicalAnd expression (allowing chaining), and the right operand is
an Equality expression (higher precedence than logical operators).
§Primary(Box<Primary>)
Represents expressions that don’t contain logical AND operations. This variant is used for AST flattening optimization.
§Examples
use aimx::expressions::{
equality::Equality,
logical::LogicalAnd,
primary::Primary,
};
use aimx::Literal;
// Represents the expression: true & false
let and_expr = LogicalAnd::And(
Box::new(LogicalAnd::Primary(Box::new(Primary::Literal(Literal::Bool(true))))),
Equality::Primary(Box::new(Primary::Literal(Literal::Bool(false))))
);§Evaluation
When evaluated, LogicalAnd expressions:
- Require boolean operands for AND operations
- Return
trueonly if both operands evaluate totrue - Provide detailed error messages for type mismatches
§See Also
Variants§
Trait Implementations§
Source§impl Clone for LogicalAnd
impl Clone for LogicalAnd
Source§fn clone(&self) -> LogicalAnd
fn clone(&self) -> LogicalAnd
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 LogicalAnd
impl Debug for LogicalAnd
Source§impl Display for LogicalAnd
impl Display for LogicalAnd
Source§impl ExpressionLike for LogicalAnd
impl ExpressionLike for LogicalAnd
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 LogicalAnd
impl PartialEq for LogicalAnd
impl StructuralPartialEq for LogicalAnd
Auto Trait Implementations§
impl Freeze for LogicalAnd
impl RefUnwindSafe for LogicalAnd
impl Send for LogicalAnd
impl Sync for LogicalAnd
impl Unpin for LogicalAnd
impl UnwindSafe for LogicalAnd
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.