#[non_exhaustive]pub enum Expression {
Show 14 variants
Null,
Bool(bool),
Number(Number),
String(String),
Array(Vec<Expression>),
Object(Object<ObjectKey, Expression>),
TemplateExpr(Box<TemplateExpr>),
Variable(Variable),
Traversal(Box<Traversal>),
FuncCall(Box<FuncCall>),
Parenthesis(Box<Expression>),
Conditional(Box<Conditional>),
Operation(Box<Operation>),
ForExpr(Box<ForExpr>),
}
Expand description
A type representing the expression sub-language. It is used in HCL attributes to specify values and in HCL templates.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
Represents a null value.
Bool(bool)
Represents a boolean.
Number(Number)
Represents a number, either integer or float.
String(String)
Represents a string that does not contain any template interpolations or template directives.
Array(Vec<Expression>)
Represents array.
Object(Object<ObjectKey, Expression>)
Represents an object.
TemplateExpr(Box<TemplateExpr>)
A quoted string or heredoc that embeds a program written in the template sub-language.
Variable(Variable)
Represents a variable name identifier.
Traversal(Box<Traversal>)
Represents an attribute or element traversal.
FuncCall(Box<FuncCall>)
Represents a function call.
Parenthesis(Box<Expression>)
Represents a sub-expression that is wrapped in parenthesis.
Conditional(Box<Conditional>)
A conditional operator which selects one of two rexpressions based on the outcome of a boolean expression.
Operation(Box<Operation>)
An operation which applies a particular operator to either one or two expression terms.
ForExpr(Box<ForExpr>)
A construct for constructing a collection by projecting the items from another collection.
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<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserializer<'de> for Expression
impl<'de> Deserializer<'de> for Expression
Source§type Error = Error
type Error = Error
Source§fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i8
value.Source§fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i16
value.Source§fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i32
value.Source§fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i64
value.Source§fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Source§fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u8
value.Source§fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u16
value.Source§fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u32
value.Source§fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u64
value.Source§fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Source§fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a f32
value.Source§fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a f64
value.Source§fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read moreSource§fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an optional value. Read moreSource§fn deserialize_enum<V>(
self,
name: &'static str,
_variants: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_enum<V>(
self,
name: &'static str,
_variants: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an enum value with a
particular name and possible variants.Source§fn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a newtype struct with a
particular name.Source§fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a bool
value.Source§fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a char
value.Source§fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a string value and does
not benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a string value and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a byte array and does not
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a byte array and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a unit value.Source§fn deserialize_unit_struct<V>(
self,
_name: &'static str,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_unit_struct<V>(
self,
_name: &'static str,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a unit struct with a
particular name.Source§fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a sequence of values.Source§fn deserialize_tuple<V>(
self,
_len: usize,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_tuple<V>(
self,
_len: usize,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data.Source§fn deserialize_tuple_struct<V>(
self,
_name: &'static str,
_len: usize,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_tuple_struct<V>(
self,
_name: &'static str,
_len: usize,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a tuple struct with a
particular name and number of fields.Source§fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a map of key-value pairs.Source§fn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a struct with a particular
name and fields.Source§fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting the name of a struct
field or the discriminant of an enum variant.Source§fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type needs to deserialize a value whose type
doesn’t matter because it is ignored. Read moreSource§fn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Deserialize
implementations should expect to
deserialize their human-readable form. Read moreSource§impl Display for Expression
impl Display for Expression
Source§impl<'de> EnumAccess<'de> for Expression
impl<'de> EnumAccess<'de> for Expression
Source§type Error = Error
type Error = Error
Source§type Variant = Expression
type Variant = Expression
Visitor
that will be used to deserialize the content of the enum
variant.Source§fn variant_seed<T>(
self,
seed: T,
) -> Result<(T::Value, Self::Variant), Self::Error>where
T: DeserializeSeed<'de>,
fn variant_seed<T>(
self,
seed: T,
) -> Result<(T::Value, Self::Variant), Self::Error>where
T: DeserializeSeed<'de>,
variant
is called to identify which variant to deserialize. Read moreSource§impl Evaluate for Expression
impl Evaluate for Expression
Source§fn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>
fn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>
Context
. Read moreSource§fn evaluate_in_place(&mut self, ctx: &Context<'_>) -> EvalResult<(), Errors>
fn evaluate_in_place(&mut self, ctx: &Context<'_>) -> EvalResult<(), Errors>
Source§impl Format for Expression
impl Format for Expression
Source§fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where
W: Write,
fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where
W: Write,
Source§impl<'a, T: Clone + Into<Expression>> From<&'a [T]> for Expression
impl<'a, T: Clone + Into<Expression>> From<&'a [T]> for Expression
Source§impl From<&str> for Expression
impl From<&str> for Expression
Source§impl From<()> for Expression
impl From<()> 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(cond: Conditional) -> Self
fn from(cond: Conditional) -> Self
Source§impl From<Expression> for Expression
impl From<Expression> for Expression
Source§fn from(value: Expression) -> Self
fn from(value: Expression) -> Self
Source§impl From<Expression> for Expression
impl From<Expression> for Expression
Source§fn from(value: Expression) -> Self
fn from(value: Expression) -> Self
Source§impl From<Expression> for ObjectValue
impl From<Expression> for ObjectValue
Source§fn from(value: Expression) -> Self
fn from(value: Expression) -> Self
Source§impl From<Expression> for TraversalOperator
impl From<Expression> for TraversalOperator
Source§fn from(value: Expression) -> TraversalOperator
fn from(value: Expression) -> TraversalOperator
Source§impl From<Expression> for Value
impl From<Expression> for Value
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<Heredoc> for Expression
impl From<Heredoc> for Expression
Source§impl From<Number> for Expression
impl From<Number> for Expression
Source§impl From<ObjectValue> for Expression
impl From<ObjectValue> for Expression
Source§fn from(value: ObjectValue) -> Self
fn from(value: ObjectValue) -> Self
Source§impl From<Operation> for Expression
impl From<Operation> for Expression
Source§impl From<String> for Expression
impl From<String> for Expression
Source§impl<T> From<T> for Expressionwhere
T: IntoJsonSpec,
impl<T> From<T> for Expressionwhere
T: IntoJsonSpec,
Source§fn from(value: T) -> Expression
fn from(value: T) -> Expression
Source§impl From<TemplateExpr> for Expression
impl From<TemplateExpr> for Expression
Source§fn from(expr: TemplateExpr) -> Self
fn from(expr: TemplateExpr) -> 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 From<Value> for Expression
impl From<Value> for Expression
Source§impl From<Variable> for Expression
impl From<Variable> for Expression
Source§impl<T: Into<Expression>> From<Vec<T>> for Expression
impl<T: Into<Expression>> From<Vec<T>> for Expression
Source§impl From<VecMap<ObjectKey, Expression>> for Expression
impl From<VecMap<ObjectKey, Expression>> for 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<Expression>> FromIterator<(K, V)> for Expression
impl<K: Into<ObjectKey>, V: Into<Expression>> 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<'de> IntoDeserializer<'de, Error> for Expression
impl<'de> IntoDeserializer<'de, Error> for Expression
Source§type Deserializer = Expression
type Deserializer = Expression
Source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§impl Serialize for Expression
impl Serialize for Expression
Source§impl<'de> VariantAccess<'de> for Expression
impl<'de> VariantAccess<'de> for Expression
Source§type Error = Error
type Error = Error
EnumAccess
.Source§fn unit_variant(self) -> Result<(), Self::Error>
fn unit_variant(self) -> Result<(), Self::Error>
Source§fn newtype_variant_seed<T>(self, seed: T) -> Result<T::Value, Self::Error>where
T: DeserializeSeed<'de>,
fn newtype_variant_seed<T>(self, seed: T) -> Result<T::Value, Self::Error>where
T: DeserializeSeed<'de>,
Source§fn tuple_variant<V>(
self,
_len: usize,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn tuple_variant<V>(
self,
_len: usize,
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Source§fn struct_variant<V>(
self,
_fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn struct_variant<V>(
self,
_fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Source§fn newtype_variant<T>(self) -> Result<T, Self::Error>where
T: Deserialize<'de>,
fn newtype_variant<T>(self) -> Result<T, Self::Error>where
T: Deserialize<'de>,
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.