Enum liquid_core::Value
source · [−]Expand description
An enum to represent different value types
Variants
Scalar(Scalar)
A scalar value.
Array(Array)
A sequence of Value
s.
Object(Object)
A sequence of key/Value
pairs.
State(State)
Query symbol.
Nil
Nothing.
Implementations
sourceimpl Value
impl Value
sourcepub fn array<I: IntoIterator<Item = Value>>(iter: I) -> Value
pub fn array<I: IntoIterator<Item = Value>>(iter: I) -> Value
Create as an Array
.
sourcepub fn into_scalar(self) -> Option<Scalar>
pub fn into_scalar(self) -> Option<Scalar>
Extracts the scalar value if it is a scalar.
sourcepub fn into_array(self) -> Option<Array>
pub fn into_array(self) -> Option<Array>
Extracts the array value if it is an array.
sourcepub fn as_array_mut(&mut self) -> Option<&mut Array>
pub fn as_array_mut(&mut self) -> Option<&mut Array>
Extracts the array value as mutable if it is a object.
sourcepub fn into_object(self) -> Option<Object>
pub fn into_object(self) -> Option<Object>
Extracts the object value if it is a object.
sourcepub fn as_object_mut(&mut self) -> Option<&mut Object>
pub fn as_object_mut(&mut self) -> Option<&mut Object>
Extracts the object value as mutable if it is a object.
sourcepub fn into_state(self) -> Option<State>
pub fn into_state(self) -> Option<State>
Extracts the state if it is one
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'s> PartialEq<KStringRef<'s>> for Value
impl<'s> PartialEq<KStringRef<'s>> for Value
sourceimpl<'v> PartialEq<ValueViewCmp<'v>> for Value
impl<'v> PartialEq<ValueViewCmp<'v>> for Value
sourceimpl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
sourceimpl ValueView for Value
impl ValueView for Value
sourcefn render(&self) -> DisplayCow<'_>
fn render(&self) -> DisplayCow<'_>
A Display
for a BoxedValue
rendered for the user.
sourcefn source(&self) -> DisplayCow<'_>
fn source(&self) -> DisplayCow<'_>
A Display
for a Value
as source code.
sourcefn query_state(&self, state: State) -> bool
fn query_state(&self, state: State) -> bool
Query the value’s state
sourcefn to_kstr(&self) -> KStringCow<'_>
fn to_kstr(&self) -> KStringCow<'_>
Interpret as a string.
sourcefn as_object(&self) -> Option<&dyn ObjectView>
fn as_object(&self) -> Option<&dyn ObjectView>
Extracts the object value if it is a object.
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 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