Enum hcl::Expression
source · #[non_exhaustive]
pub enum Expression {
Show 15 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>),
Raw(RawExpression),
}
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.
Raw(RawExpression)
Represents a raw HCL expression. This variant will never be emitted by the parser. See
RawExpression
for more details.
Trait Implementations
sourceimpl Clone for Expression
impl Clone for Expression
sourcefn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for Expression
impl Debug for Expression
sourceimpl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
sourcefn 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>,
sourceimpl<'de> Deserializer<'de> for Expression
impl<'de> Deserializer<'de> for Expression
type Error = Error
type Error = Error
sourcefn 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.sourcefn 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.sourcefn 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.sourcefn 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.sourcefn 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.sourcefn 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>,
sourcefn 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.sourcefn 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.sourcefn 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.sourcefn 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.sourcefn 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>,
sourcefn 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.sourcefn 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.sourcefn 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.sourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn 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.sourcefn 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. Read moresourcefn 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. Read moresourcefn 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.sourcefn 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. Read moresourcefn 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. Read moresourcefn 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.sourcefn 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. Read moresourcefn 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. Read moresourcefn 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 moresourcefn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>where
V: Visitor<'de>,
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>where
V: Visitor<'de>,
Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read moresourcefn 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. Read moresourcefn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Deserialize
implementations should expect to
deserialize their human-readable form. Read moresourceimpl Display for Expression
impl Display for Expression
sourceimpl<'de> EnumAccess<'de> for Expression
impl<'de> EnumAccess<'de> for Expression
type Error = Error
type Error = Error
type Variant = Expression
type Variant = Expression
Visitor
that will be used to deserialize the content of the enum
variant. Read moresourcefn 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 moresourceimpl Evaluate for Expression
impl Evaluate for Expression
sourceimpl Format for Expression
impl Format for Expression
sourceimpl<'a, T: Clone + Into<Expression>> From<&'a [T]> for Expression
impl<'a, T: Clone + Into<Expression>> From<&'a [T]> for Expression
sourceimpl From<&str> for Expression
impl From<&str> for Expression
sourceimpl From<()> for Expression
impl From<()> for Expression
sourceimpl From<Conditional> for Expression
impl From<Conditional> for Expression
sourcefn from(cond: Conditional) -> Self
fn from(cond: Conditional) -> Self
sourceimpl<'a> From<Cow<'a, str>> for Expression
impl<'a> From<Cow<'a, str>> for Expression
sourceimpl From<Expression> for TraversalOperator
impl From<Expression> for TraversalOperator
sourcefn from(value: Expression) -> TraversalOperator
fn from(value: Expression) -> TraversalOperator
sourceimpl From<Expression> for Value
impl From<Expression> for Value
sourcefn from(expr: Expression) -> Self
fn from(expr: Expression) -> Self
sourceimpl From<ForExpr> for Expression
impl From<ForExpr> for Expression
sourceimpl From<FuncCall> for Expression
impl From<FuncCall> for Expression
sourceimpl From<Number> for Expression
impl From<Number> for Expression
sourceimpl From<Operation> for Expression
impl From<Operation> for Expression
sourceimpl From<RawExpression> for Expression
impl From<RawExpression> for Expression
sourcefn from(raw: RawExpression) -> Self
fn from(raw: RawExpression) -> Self
sourceimpl From<String> for Expression
impl From<String> for Expression
sourceimpl From<TemplateExpr> for Expression
impl From<TemplateExpr> for Expression
sourcefn from(expr: TemplateExpr) -> Self
fn from(expr: TemplateExpr) -> Self
sourceimpl From<Traversal> for Expression
impl From<Traversal> for Expression
sourceimpl From<Value> for Expression
impl From<Value> for Expression
sourceimpl From<Variable> for Expression
impl From<Variable> for Expression
sourceimpl<T: Into<Expression>> From<Vec<T, Global>> for Expression
impl<T: Into<Expression>> From<Vec<T, Global>> for Expression
sourceimpl From<VecMap<ObjectKey, Expression>> for Expression
impl From<VecMap<ObjectKey, Expression>> for Expression
sourcefn from(f: Object<ObjectKey, Expression>) -> Self
fn from(f: Object<ObjectKey, Expression>) -> Self
sourceimpl From<bool> for Expression
impl From<bool> for Expression
sourceimpl From<f32> for Expression
impl From<f32> for Expression
sourceimpl From<f64> for Expression
impl From<f64> for Expression
sourceimpl From<i16> for Expression
impl From<i16> for Expression
sourceimpl From<i32> for Expression
impl From<i32> for Expression
sourceimpl From<i64> for Expression
impl From<i64> for Expression
sourceimpl From<i8> for Expression
impl From<i8> for Expression
sourceimpl From<isize> for Expression
impl From<isize> for Expression
sourceimpl From<u16> for Expression
impl From<u16> for Expression
sourceimpl From<u32> for Expression
impl From<u32> for Expression
sourceimpl From<u64> for Expression
impl From<u64> for Expression
sourceimpl From<u8> for Expression
impl From<u8> for Expression
sourceimpl From<usize> for Expression
impl From<usize> for Expression
sourceimpl<K: Into<ObjectKey>, V: Into<Expression>> FromIterator<(K, V)> for Expression
impl<K: Into<ObjectKey>, V: Into<Expression>> FromIterator<(K, V)> for Expression
sourcefn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
sourceimpl<T: Into<Expression>> FromIterator<T> for Expression
impl<T: Into<Expression>> FromIterator<T> for Expression
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
sourceimpl<'de> IntoDeserializer<'de, Error> for Expression
impl<'de> IntoDeserializer<'de, Error> for Expression
type Deserializer = Expression
type Deserializer = Expression
sourcefn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
sourceimpl PartialEq<Expression> for Expression
impl PartialEq<Expression> for Expression
sourcefn eq(&self, other: &Expression) -> bool
fn eq(&self, other: &Expression) -> bool
sourceimpl Serialize for Expression
impl Serialize for Expression
sourceimpl<'de> VariantAccess<'de> for Expression
impl<'de> VariantAccess<'de> for Expression
type Error = Error
type Error = Error
EnumAccess
. Read moresourcefn unit_variant(self) -> Result<(), Self::Error>
fn unit_variant(self) -> Result<(), Self::Error>
sourcefn 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>,
sourcefn 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>,
sourcefn 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>,
sourcefn 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 StructuralEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.