pub enum Value {
Null,
Bool(bool),
Number(Number),
String(String),
Array(Vec<Value>),
Object(Map<String, Value>),
}Expand description
Represents any valid HCL value.
Variants§
Null
Represents a HCL null value.
Bool(bool)
Represents a HCL boolean.
Number(Number)
Represents a HCL number, either integer or float.
String(String)
Represents a HCL string.
Array(Vec<Value>)
Represents a HCL array.
Object(Map<String, Value>)
Represents a HCL object.
Implementations§
source§impl Value
impl Value
sourcepub fn as_array(&self) -> Option<&Vec<Value>>
pub fn as_array(&self) -> Option<&Vec<Value>>
If the Value is an Array, returns the associated vector. Returns None
otherwise.
sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<Value>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value>>
If the Value is an Array, returns the associated mutable vector.
Returns None otherwise.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If the Value is a Boolean, represent it as bool if possible. Returns
None otherwise.
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
If the Value is a Number, represent it as f64 if possible. Returns
None otherwise.
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If the Value is a Number, represent it as i64 if possible. Returns
None otherwise.
sourcepub fn as_null(&self) -> Option<()>
pub fn as_null(&self) -> Option<()>
If the Value is a Null, returns (). Returns None otherwise.
sourcepub fn as_number(&self) -> Option<&Number>
pub fn as_number(&self) -> Option<&Number>
If the Value is a Number, returns the associated Number. Returns None
otherwise.
sourcepub fn as_object(&self) -> Option<&Map<String, Value>>
pub fn as_object(&self) -> Option<&Map<String, Value>>
If the Value is an Object, returns the associated Map. Returns None
otherwise.
sourcepub fn as_object_mut(&mut self) -> Option<&mut Map<String, Value>>
pub fn as_object_mut(&mut self) -> Option<&mut Map<String, Value>>
If the Value is an Object, returns the associated mutable Map.
Returns None otherwise.
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
If the Value is a String, returns the associated str. Returns None
otherwise.
sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
If the Value is a Number, represent it as u64 if possible. Returns
None otherwise.
sourcepub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Returns true if the Value is an Array. Returns false otherwise.
For any Value on which is_array returns true, as_array and
as_array_mut are guaranteed to return the vector representing the
array.
sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if the Value is a Boolean. Returns false otherwise.
For any Value on which is_boolean returns true, as_bool is
guaranteed to return the boolean value.
sourcepub fn is_f64(&self) -> bool
pub fn is_f64(&self) -> bool
Returns true if the Value is a number that can be represented by f64.
For any Value on which is_f64 returns true, as_f64 is guaranteed to
return the floating point value.
sourcepub fn is_i64(&self) -> bool
pub fn is_i64(&self) -> bool
Returns true if the Value is an integer between i64::MIN and
i64::MAX.
For any Value on which is_i64 returns true, as_i64 is guaranteed to
return the integer value.
sourcepub fn is_number(&self) -> bool
pub fn is_number(&self) -> bool
Returns true if the Value is a Number. Returns false otherwise.
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if the Value is a Null. Returns false otherwise.
For any Value on which is_null returns true, as_null is guaranteed
to return Some(()).
sourcepub fn is_object(&self) -> bool
pub fn is_object(&self) -> bool
Returns true if the Value is an Object. Returns false otherwise.
For any Value on which is_object returns true, as_object and
as_object_mut are guaranteed to return the map representation of the
object.
sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if the Value is a String. Returns false otherwise.
For any Value on which is_string returns true, as_str is guaranteed
to return the string slice.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
source§fn deserialize<D>(deserializer: D) -> Result<Value, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Value, D::Error>where
D: Deserializer<'de>,
source§impl Format for Value
impl Format for Value
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 From<Expression> for Value
impl From<Expression> for Value
source§fn from(expr: Expression) -> Self
fn from(expr: Expression) -> Self
source§impl From<Value> for Expression
impl From<Value> for Expression
source§impl<T: Into<Value>> FromIterator<T> for Value
impl<T: Into<Value>> FromIterator<T> for Value
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 Value
impl<'de> IntoDeserializer<'de, Error> for Value
source§type Deserializer = ValueDeserializer
type Deserializer = ValueDeserializer
source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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)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.