pub enum Additive {
Add(Box<Additive>, Multiplicative),
Subtract(Box<Additive>, Multiplicative),
Primary(Box<Primary>),
}Expand description
An additive expression node in the abstract syntax tree.
Represents an expression involving additive operations (+, -) or a
lower-precedence expression that has been flattened in the AST.
§Variants
Add(Box<Additive>, Multiplicative)- Addition operationSubtract(Box<Additive>, Multiplicative)- Subtraction operationPrimary(Primary)- Flattened variants from lower precedence levels
§Examples
use aimx::expressions::additive::Additive;
use aimx::Literal;
use aimx::expressions::primary::Primary;
use aimx::expressions::multiplicative::Multiplicative;
// Represents the expression: 5 + 3
let add_expr = Additive::Add(
Box::new(Additive::Primary(Box::new(Primary::Literal(Literal::Number(5.0))))),
Multiplicative::Primary(Box::new(Primary::Literal(Literal::Number(3.0))))
);Variants§
Add(Box<Additive>, Multiplicative)
Subtract(Box<Additive>, Multiplicative)
Primary(Box<Primary>)
Primary flattened AST optimization
Trait Implementations§
Source§impl ExpressionLike for Additive
impl ExpressionLike for Additive
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 Additive
Auto Trait Implementations§
impl Freeze for Additive
impl RefUnwindSafe for Additive
impl Send for Additive
impl Sync for Additive
impl Unpin for Additive
impl UnwindSafe for Additive
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.