#[non_exhaustive]pub enum Value {
Null,
Bool(bool),
Int(i64),
Number(f64),
Str(Arc<str>),
List(Vec<Value>),
Map(Map),
}Expand description
A fully-resolved HCL value.
Value is what a resolved Expression reduces to. Anything that
cannot resolve statically stays as Expression::Unresolved.
§Equality
Value is PartialEq but not Eq or Hash because Value::Number
wraps an f64 and f64::NAN != f64::NAN. Treat Value as a value type,
not as a map / set key. If you need a hashable key, hash the canonical
JSON form (20-parquet-exporter.md § 3.3)
or wrap the number in your own total-order container.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
HCL null.
Bool(bool)
Boolean.
Int(i64)
Integer literal (fast path; preserved verbatim from the source).
Number(f64)
Floating-point number — the default HCL2 numeric representation.
Str(Arc<str>)
UTF-8 string (interned-friendly via Arc<str>).
List(Vec<Value>)
Heterogeneous list.
Map(Map)
Insertion-ordered map.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the contained string slice, if self is a Value::Str.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the contained boolean, if self is a Value::Bool.
Sourcepub fn as_int(&self) -> Option<i64>
pub fn as_int(&self) -> Option<i64>
Returns the contained integer, if self is a Value::Int.