pub enum Expression {
Show 16 variants Null(Decorated<Null>), Bool(Decorated<bool>), Number(Formatted<Number>), String(Decorated<String>), Array(Array), Object(Object), Template(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.

§

Template(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.

Trait Implementations§

source§

impl Clone for Expression

source§

fn clone(&self) -> Expression

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Expression

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Decorate for Expression

source§

fn decor(&self) -> &Decor

Returns a reference to the object’s Decor.
source§

fn decor_mut(&mut self) -> &mut Decor

Returns a mutable reference to the object’s Decor.
source§

fn decorate(&mut self, decor: impl Into<Decor>)

Decorate the object with decor in-place.
source§

fn decorated(self, decor: impl Into<Decor>) -> Selfwhere Self: Sized,

Decorate the object with decor and return the modified value.
source§

impl Display for Expression

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&str> for Expression

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<Array> for Expression

source§

fn from(value: Array) -> Self

Converts to this type from the input type.
source§

impl From<BinaryOp> for Expression

source§

fn from(value: BinaryOp) -> Self

Converts to this type from the input type.
source§

impl From<Conditional> for Expression

source§

fn from(value: Conditional) -> Self

Converts to this type from the input type.
source§

impl From<Decorated<Ident>> for Expression

source§

fn from(value: Decorated<Ident>) -> Self

Converts to this type from the input type.
source§

impl From<Decorated<String>> for Expression

source§

fn from(value: Decorated<String>) -> Self

Converts to this type from the input type.
source§

impl From<Decorated<bool>> for Expression

source§

fn from(value: Decorated<bool>) -> Self

Converts to this type from the input type.
source§

impl From<Expression> for ForCond

source§

fn from(value: Expression) -> Self

Converts to this type from the input type.
source§

impl From<Expression> for ObjectKey

source§

fn from(expr: Expression) -> Self

Converts to this type from the input type.
source§

impl From<Expression> for ObjectValue

source§

fn from(expr: Expression) -> Self

Converts to this type from the input type.
source§

impl From<ForExpr> for Expression

source§

fn from(value: ForExpr) -> Self

Converts to this type from the input type.
source§

impl From<Formatted<Number>> for Expression

source§

fn from(value: Formatted<Number>) -> Self

Converts to this type from the input type.
source§

impl From<FuncCall> for Expression

source§

fn from(value: FuncCall) -> Self

Converts to this type from the input type.
source§

impl From<HeredocTemplate> for Expression

source§

fn from(value: HeredocTemplate) -> Self

Converts to this type from the input type.
source§

impl From<Ident> for Expression

source§

fn from(value: Ident) -> Self

Converts to this type from the input type.
source§

impl From<Number> for Expression

source§

fn from(value: Number) -> Self

Converts to this type from the input type.
source§

impl From<Object> for Expression

source§

fn from(value: Object) -> Self

Converts to this type from the input type.
source§

impl From<Parenthesis> for Expression

source§

fn from(value: Parenthesis) -> Self

Converts to this type from the input type.
source§

impl From<String> for Expression

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<StringTemplate> for Expression

source§

fn from(value: StringTemplate) -> Self

Converts to this type from the input type.
source§

impl From<Traversal> for Expression

source§

fn from(value: Traversal) -> Self

Converts to this type from the input type.
source§

impl From<UnaryOp> for Expression

source§

fn from(value: UnaryOp) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Expression

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl FromStr for Expression

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq<Expression> for Expression

source§

fn eq(&self, other: &Expression) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Span for Expression

source§

fn span(&self) -> Option<Range<usize>>

Obtains the span information. This only returns Some if the value was emitted by the parser. Read more
source§

impl Eq for Expression

source§

impl StructuralEq for Expression

source§

impl StructuralPartialEq for Expression

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.