pub enum Expression {
Show 16 variants
    Null(Decorated<Null>),
    Bool(Decorated<bool>),
    Number(Formatted<Number>),
    String(Decorated<String>),
    Array(Array),
    Object(Object),
    StringTemplate(StringTemplate),
    HeredocTemplate(Box<HeredocTemplate>),
    Parenthesis(Box<Parenthesis>),
    Variable(Decorated<Ident>),
    Conditional(Box<Conditional>),
    FuncCall(Box<FuncCall>),
    Traversal(Box<Traversal>),
    UnaryOp(Box<UnaryOp>),
    BinaryOp(Box<BinaryOp>),
    ForExpr(Box<ForExpr>),
}Expand description
A type representing any expression from the expression sub-language.
Variants§
Null(Decorated<Null>)
Represents a null value.
Bool(Decorated<bool>)
Represents a boolean.
Number(Formatted<Number>)
Represents a number, either integer or float.
String(Decorated<String>)
Represents a string that does not contain any template interpolations or template directives.
Array(Array)
Represents an HCL array.
Object(Object)
Represents an HCL object.
StringTemplate(StringTemplate)
Represents a string containing template interpolations and template directives.
HeredocTemplate(Box<HeredocTemplate>)
Represents an HCL heredoc template.
Parenthesis(Box<Parenthesis>)
Represents a sub-expression wrapped in parenthesis.
Variable(Decorated<Ident>)
Represents a variable identifier.
Conditional(Box<Conditional>)
Represents conditional operator which selects one of two rexpressions based on the outcome of a boolean expression.
FuncCall(Box<FuncCall>)
Represents a function call.
Traversal(Box<Traversal>)
Represents an attribute or element traversal.
UnaryOp(Box<UnaryOp>)
Represents an operation which applies a unary operator to an expression.
BinaryOp(Box<BinaryOp>)
Represents an operation which applies a binary operator to two expressions.
ForExpr(Box<ForExpr>)
Represents a construct for constructing a collection by projecting the items from another collection.
Implementations§
source§impl Expression
 
impl Expression
sourcepub fn null() -> Expression
 
pub fn null() -> Expression
Creates a null expression.
sourcepub fn as_bool(&self) -> Option<bool>
 
pub fn as_bool(&self) -> Option<bool>
If the expression is a bool, returns a reference to it, otherwise None.
sourcepub fn as_number(&self) -> Option<&Number>
 
pub fn as_number(&self) -> Option<&Number>
If the expression is a number, returns a reference to it, otherwise None.
sourcepub fn as_str(&self) -> Option<&str>
 
pub fn as_str(&self) -> Option<&str>
If the expression is a string, returns a reference to it, otherwise None.
sourcepub fn as_array(&self) -> Option<&Array>
 
pub fn as_array(&self) -> Option<&Array>
If the expression is an array, returns a reference to it, otherwise None.
sourcepub fn as_array_mut(&mut self) -> Option<&mut Array>
 
pub fn as_array_mut(&mut self) -> Option<&mut Array>
If the expression is an array, returns a mutable reference to it, otherwise None.
sourcepub fn as_object(&self) -> Option<&Object>
 
pub fn as_object(&self) -> Option<&Object>
If the expression is an object, returns a reference to it, otherwise None.
sourcepub fn as_object_mut(&mut self) -> Option<&mut Object>
 
pub fn as_object_mut(&mut self) -> Option<&mut Object>
If the expression is an object, returns a mutable reference to it, otherwise None.
sourcepub fn is_template(&self) -> bool
 
pub fn is_template(&self) -> bool
Returns true if the expression is either of variant StringTemplate or
HeredocTemplate.
sourcepub fn as_template(&self) -> Option<&Template>
 
pub fn as_template(&self) -> Option<&Template>
If the expression is either of variant StringTemplate or HeredocTemplate, returns a
reference to the underlying Template, otherwise None.
sourcepub fn is_string_template(&self) -> bool
 
pub fn is_string_template(&self) -> bool
Returns true if the expression is a string template.
sourcepub fn as_string_template(&self) -> Option<&StringTemplate>
 
pub fn as_string_template(&self) -> Option<&StringTemplate>
If the expression is a string template, returns a reference to it, otherwise None.
sourcepub fn is_heredoc_template(&self) -> bool
 
pub fn is_heredoc_template(&self) -> bool
Returns true if the expression is a heredoc template.
sourcepub fn as_heredoc_template(&self) -> Option<&HeredocTemplate>
 
pub fn as_heredoc_template(&self) -> Option<&HeredocTemplate>
If the expression is a heredoc template, returns a reference to it, otherwise None.
sourcepub fn is_parenthesis(&self) -> bool
 
pub fn is_parenthesis(&self) -> bool
Returns true if the expression is wrapped in parenthesis.
sourcepub fn as_parenthesis(&self) -> Option<&Parenthesis>
 
pub fn as_parenthesis(&self) -> Option<&Parenthesis>
If the expression is an expression wrapped in parenthesis, returns a reference to it,
otherwise None.
sourcepub fn is_variable(&self) -> bool
 
pub fn is_variable(&self) -> bool
Returns true if the expression is a variable.
sourcepub fn as_variable(&self) -> Option<&Ident>
 
pub fn as_variable(&self) -> Option<&Ident>
If the expression is a variable, returns a reference to it, otherwise None.
sourcepub fn is_conditional(&self) -> bool
 
pub fn is_conditional(&self) -> bool
Returns true if the expression is a conditional.
sourcepub fn as_conditional(&self) -> Option<&Conditional>
 
pub fn as_conditional(&self) -> Option<&Conditional>
If the expression is a conditional, returns a reference to it, otherwise None.
sourcepub fn is_func_call(&self) -> bool
 
pub fn is_func_call(&self) -> bool
Returns true if the expression is a function call.
sourcepub fn as_func_call(&self) -> Option<&FuncCall>
 
pub fn as_func_call(&self) -> Option<&FuncCall>
If the expression is a function call, returns a reference to it, otherwise None.
sourcepub fn is_traversal(&self) -> bool
 
pub fn is_traversal(&self) -> bool
Returns true if the expression is a traversal.
sourcepub fn as_traversal(&self) -> Option<&Traversal>
 
pub fn as_traversal(&self) -> Option<&Traversal>
If the expression is a traversal, returns a reference to it, otherwise None.
sourcepub fn is_unary_op(&self) -> bool
 
pub fn is_unary_op(&self) -> bool
Returns true if the expression is a unary op.
sourcepub fn as_unary_op(&self) -> Option<&UnaryOp>
 
pub fn as_unary_op(&self) -> Option<&UnaryOp>
If the expression is a unary op, returns a reference to it, otherwise None.
sourcepub fn is_binary_op(&self) -> bool
 
pub fn is_binary_op(&self) -> bool
Returns true if the expression is a binary op.
sourcepub fn as_binary_op(&self) -> Option<&BinaryOp>
 
pub fn as_binary_op(&self) -> Option<&BinaryOp>
If the expression is a binary op, returns a reference to it, otherwise None.
sourcepub fn is_for_expr(&self) -> bool
 
pub fn is_for_expr(&self) -> bool
Returns true if the expression is a for expression.
sourcepub fn as_for_expr(&self) -> Option<&ForExpr>
 
pub fn as_for_expr(&self) -> Option<&ForExpr>
If the expression is a for expression, returns a reference to it, otherwise None.
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 Decorate for Expression
 
impl Decorate for Expression
source§impl Display for Expression
 
impl Display for Expression
source§impl<'a, T> From<&'a [T]> for Expression
 
impl<'a, T> From<&'a [T]> for Expression
source§impl From<&str> for Expression
 
impl From<&str> for Expression
source§impl From<Array> for Expression
 
impl From<Array> for Expression
source§impl From<BinaryOp> for Expression
 
impl From<BinaryOp> for Expression
source§impl From<Conditional> for Expression
 
impl From<Conditional> for Expression
source§fn from(value: Conditional) -> Self
 
fn from(value: Conditional) -> Self
source§impl From<Expression> for ForCond
 
impl From<Expression> for ForCond
source§fn from(value: Expression) -> Self
 
fn from(value: Expression) -> Self
source§impl From<Expression> for ObjectKey
 
impl From<Expression> for ObjectKey
source§fn from(expr: Expression) -> Self
 
fn from(expr: Expression) -> Self
source§impl From<Expression> for ObjectValue
 
impl From<Expression> for ObjectValue
source§fn from(expr: Expression) -> Self
 
fn from(expr: Expression) -> Self
source§impl From<ForExpr> for Expression
 
impl From<ForExpr> for Expression
source§impl From<FuncCall> for Expression
 
impl From<FuncCall> for Expression
source§impl From<HeredocTemplate> for Expression
 
impl From<HeredocTemplate> for Expression
source§fn from(value: HeredocTemplate) -> Self
 
fn from(value: HeredocTemplate) -> Self
source§impl From<Ident> for Expression
 
impl From<Ident> for Expression
source§impl From<Number> for Expression
 
impl From<Number> for Expression
source§impl From<Object> for Expression
 
impl From<Object> for Expression
source§impl From<Parenthesis> for Expression
 
impl From<Parenthesis> for Expression
source§fn from(value: Parenthesis) -> Self
 
fn from(value: Parenthesis) -> Self
source§impl From<String> for Expression
 
impl From<String> for Expression
source§impl From<StringTemplate> for Expression
 
impl From<StringTemplate> for Expression
source§fn from(value: StringTemplate) -> Self
 
fn from(value: StringTemplate) -> Self
source§impl From<Traversal> for Expression
 
impl From<Traversal> for Expression
source§impl From<UnaryOp> for Expression
 
impl From<UnaryOp> for Expression
source§impl<T> From<Vec<T>> for Expressionwhere
    T: Into<Expression>,
 
impl<T> From<Vec<T>> for Expressionwhere
    T: Into<Expression>,
source§impl From<bool> for Expression
 
impl From<bool> for Expression
source§impl From<f32> for Expression
 
impl From<f32> for Expression
source§impl From<f64> for Expression
 
impl From<f64> for Expression
source§impl From<i16> for Expression
 
impl From<i16> for Expression
source§impl From<i32> for Expression
 
impl From<i32> for Expression
source§impl From<i64> for Expression
 
impl From<i64> for Expression
source§impl From<i8> for Expression
 
impl From<i8> for Expression
source§impl From<isize> for Expression
 
impl From<isize> for Expression
source§impl From<u16> for Expression
 
impl From<u16> for Expression
source§impl From<u32> for Expression
 
impl From<u32> for Expression
source§impl From<u64> for Expression
 
impl From<u64> for Expression
source§impl From<u8> for Expression
 
impl From<u8> for Expression
source§impl From<usize> for Expression
 
impl From<usize> for Expression
source§impl<K: Into<ObjectKey>, V: Into<ObjectValue>> FromIterator<(K, V)> for Expression
 
impl<K: Into<ObjectKey>, V: Into<ObjectValue>> FromIterator<(K, V)> for Expression
source§impl<T: Into<Expression>> FromIterator<T> for Expression
 
impl<T: Into<Expression>> FromIterator<T> for Expression
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
 
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
source§impl FromStr for Expression
 
impl FromStr for Expression
source§impl PartialEq for Expression
 
impl PartialEq for Expression
source§impl Span for Expression
 
impl Span for Expression
impl Eq for Expression
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)