pub enum Expression {
Empty,
Errata(Errata),
Single(Conditional),
Array(Vec<Box<Conditional>>),
ArgumentList(Vec<Box<Closure>>),
Branch(Branch),
Retry(Retry),
Primary(Box<Primary>),
}Expand description
Root AST node for parsed AIMX expressions.
Variants cover empty input, parse/evaluation errors, single expressions,
comma-separated arrays, function argument lists, control-flow constructs
(Branch, Retry), and flattened primaries for simple expressions.
Used by higher-level APIs as the evaluatable expression representation.
Variants§
Empty
Errata(Errata)
Single(Conditional)
Array(Vec<Box<Conditional>>)
ArgumentList(Vec<Box<Closure>>)
Branch(Branch)
Retry(Retry)
Primary(Box<Primary>)
Primary flattened AST optimization
Implementations§
Source§impl Expression
impl Expression
pub fn convert(input: &str) -> Self
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this is Expression::Empty.
Sourcepub fn is_error(&self) -> bool
pub fn is_error(&self) -> bool
Returns true if this is Expression::Errata.
Sourcepub fn is_branch(&self) -> bool
pub fn is_branch(&self) -> bool
Returns true if this is Expression::Branch.
Sourcepub fn is_retry(&self) -> bool
pub fn is_retry(&self) -> bool
Returns true if this is Expression::Retry.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl Display for Expression
impl Display for Expression
Source§impl ExpressionLike for Expression
impl ExpressionLike for Expression
Source§fn evaluate(&self, context: &mut dyn ContextLike) -> Result<Arc<Value>>
fn evaluate(&self, context: &mut dyn ContextLike) -> Result<Arc<Value>>
Evaluate this expression within the given ContextLike.
Propagates Errata as Value::Errata, short-circuits on
error-valued elements in arrays/argument lists, and delegates to
inner node evaluators for other variants.
Source§fn to_formula(&self) -> String
fn to_formula(&self) -> String
Return the formula-string representation (round-trippable by the parser).
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§impl WriterLike for Expression
impl WriterLike for Expression
Source§fn to_stringized(&self) -> String
fn to_stringized(&self) -> String
Source§fn to_sanitized(&self) -> String
fn to_sanitized(&self) -> String
Source§fn to_expressionized(&self) -> String
fn to_expressionized(&self) -> String
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 UnwindSafe for Expression
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
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.