Enum liquid_interpreter::value::Value
source · pub enum Value {
Scalar(Scalar),
Array(Vec<Value, Global>),
Object(HashMap<Cow<'static, str>, Value, RandomState>),
Nil,
}
Expand description
An enum to represent different value types
Variants§
Scalar(Scalar)
A scalar value.
Array(Vec<Value, Global>)
A sequence of Value
s.
Object(HashMap<Cow<'static, str>, Value, RandomState>)
A sequence of key/Value
pairs.
Nil
Nothing.
Implementations§
source§impl Value
impl Value
sourcepub fn array<I>(iter: I) -> Valuewhere
I: IntoIterator<Item = Value>,
pub fn array<I>(iter: I) -> Valuewhere
I: IntoIterator<Item = Value>,
Create as an Array
.
sourcepub fn as_array(&self) -> Option<&Vec<Value, Global>>
pub fn as_array(&self) -> Option<&Vec<Value, Global>>
Extracts the array value if it is an array.
sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<Value, Global>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value, Global>>
Extracts the array value if it is an array.
sourcepub fn as_object(
&self
) -> Option<&HashMap<Cow<'static, str>, Value, RandomState>>
pub fn as_object(
&self
) -> Option<&HashMap<Cow<'static, str>, Value, RandomState>>
Extracts the object value if it is a object.
sourcepub fn as_object_mut(
&mut self
) -> Option<&mut HashMap<Cow<'static, str>, Value, RandomState>>
pub fn as_object_mut(
&mut self
) -> Option<&mut HashMap<Cow<'static, str>, Value, RandomState>>
Extracts the object value if it is a object.
sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Whether a default constructed value.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for Value
impl Serialize for Value
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more