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
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: Into<Value>> FromIterator<T> for Value
impl<T: Into<Value>> FromIterator<T> for Value
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more