Enum liquid_compiler::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 Values.
Object(HashMap<Cow<'static, str>, Value, RandomState>)
A sequence of key/Value pairs.
Nil
Nothing.
Implementations
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
sourcefn 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
sourceimpl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
sourcefn partial_cmp(&self, other: &Value) -> Option<Ordering>
fn partial_cmp(&self, other: &Value) -> Option<Ordering>
1.0.0 · sourcefn 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 moresourceimpl Serialize for Value
impl Serialize for Value
sourcefn 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
impl Eq 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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