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

If the Value is an Array, returns the associated vector. Returns None otherwise.

If the Value is an Array, returns the associated mutable vector. Returns None otherwise.

If the Value is a Boolean, represent it as bool if possible. Returns None otherwise.

If the Value is a Number, represent it as f64 if possible. Returns None otherwise.

If the Value is a Number, represent it as i64 if possible. Returns None otherwise.

If the Value is a Null, returns (). Returns None otherwise.

If the Value is a Number, returns the associated Number. Returns None otherwise.

If the Value is an Object, returns the associated Map. Returns None otherwise.

If the Value is an Object, returns the associated mutable Map. Returns None otherwise.

If the Value is a String, returns the associated str. Returns None otherwise.

If the Value is a Number, represent it as u64 if possible. Returns None otherwise.

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.

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.

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.

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.

Returns true if the Value is a Number. Returns false otherwise.

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(()).

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.

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.

Returns true if the Value is an integer between zero and u64::MAX.

For any Value on which is_u64 returns true, as_u64 is guaranteed to return the integer value.

Takes the value out of the Value, leaving a Null in its place.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.