[−][src]Enum liquid::value::Value
An enum to represent different value types
Variants
Scalar(ScalarCow<'static>)
A scalar value.
Array(Vec<Value>)
A sequence of Value
s.
Object(Map)
A sequence of key/Value
pairs.
Nil
Nothing.
Empty
No content.
Blank
Evaluates to empty string.
Methods
impl Value
[src]
pub fn scalar<T>(value: T) -> Value where
T: Into<ScalarCow<'static>>,
[src]
T: Into<ScalarCow<'static>>,
Create as a Scalar
.
pub fn array<I>(iter: I) -> Value where
I: IntoIterator<Item = Value>,
[src]
I: IntoIterator<Item = Value>,
Create as an Array
.
pub fn nil() -> Value
[src]
Create as nothing.
pub fn source(&self) -> ValueSource
[src]
A Display
for a Scalar
as source code.
pub fn render(&self) -> ValueRendered
[src]
A Display
for a Value
rendered for the user.
pub fn to_str(&self) -> Cow<str>
[src]
Interpret as a string.
pub fn as_scalar(&self) -> Option<&ScalarCow<'static>>
[src]
Extracts the scalar value if it is a scalar.
pub fn into_scalar(self) -> Option<ScalarCow<'static>>
[src]
Extracts the scalar value if it is a scalar.
pub fn is_scalar(&self) -> bool
[src]
Tests whether this value is a scalar
pub fn as_array(&self) -> Option<&Vec<Value>>
[src]
Extracts the array value if it is an array.
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value>>
[src]
Extracts the array value if it is an array.
pub fn into_array(self) -> Option<Vec<Value>>
[src]
Extracts the array value if it is an array.
pub fn is_array(&self) -> bool
[src]
Tests whether this value is an array
pub fn as_object(&self) -> Option<&Map>
[src]
Extracts the object value if it is a object.
pub fn as_object_mut(&mut self) -> Option<&mut Map>
[src]
Extracts the object value if it is a object.
pub fn into_object(self) -> Option<Map>
[src]
Extracts the object value if it is a object.
pub fn is_object(&self) -> bool
[src]
Tests whether this value is an object
pub fn as_nil(&self) -> Option<()>
[src]
Extracts the nil value if it is nil
pub fn is_nil(&self) -> bool
[src]
Tests whether this value is nil
pub fn as_empty(&self) -> Option<()>
[src]
Extracts the empty value if it is empty
pub fn is_empty(&self) -> bool
[src]
Tests whether this value is empty
pub fn as_blank(&self) -> Option<()>
[src]
Extracts the blank value if it is blank
pub fn is_blank(&self) -> bool
[src]
Tests whether this value is blank
pub fn is_truthy(&self) -> bool
[src]
Evaluate using Liquid "truthiness"
pub fn is_default(&self) -> bool
[src]
Whether a default constructed value.
pub fn type_name(&self) -> &'static str
[src]
Report the data type (generally for error reporting).
pub fn contains_key(&self, index: &ScalarCow<'static>) -> bool
[src]
Access a contained Value
.
ⓘImportant traits for Keyspub fn keys(&self) -> Keys
[src]
Keys available for lookup.
pub fn get(&'s self, index: &ScalarCow) -> Option<&'s Value>
[src]
Access a contained Value
.
Trait Implementations
impl Eq for Value
[src]
impl Default for Value
[src]
impl<'de> Deserialize<'de> for Value
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Value, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Value, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Clone for Value
[src]
fn clone(&self) -> Value
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Value> for Value
[src]
fn eq(&self, other: &Value) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialOrd<Value> for Value
[src]
fn partial_cmp(&self, other: &Value) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Value
[src]
impl Serialize for Value
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
impl Send for Value
impl Unpin for Value
impl Sync for Value
impl UnwindSafe for Value
impl RefUnwindSafe for Value
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,