Struct liquid_core::model::ScalarCow
source · pub struct ScalarCow<'s>(/* private fields */);Expand description
A Liquid scalar value
Implementations§
source§impl<'s> ScalarCow<'s>
impl<'s> ScalarCow<'s>
sourcepub fn into_owned(self) -> Scalar
pub fn into_owned(self) -> Scalar
Create an owned version of the value.
sourcepub fn into_string(self) -> KString
pub fn into_string(self) -> KString
Convert to a string.
sourcepub fn to_integer(&self) -> Option<i64>
pub fn to_integer(&self) -> Option<i64>
Interpret as an integer, if possible
sourcepub fn to_date_time(&self) -> Option<DateTime>
pub fn to_date_time(&self) -> Option<DateTime>
Interpret as a date time, if possible
sourcepub fn into_cow_str(self) -> Cow<'s, str>
pub fn into_cow_str(self) -> Cow<'s, str>
Interpret as a Cow str, borrowing if possible
Trait Implementations§
source§impl<'de, 's> Deserialize<'de> for ScalarCow<'s>
impl<'de, 's> Deserialize<'de> for ScalarCow<'s>
source§fn 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
source§impl<'s> Extend<ScalarCow<'s>> for Path<'s>
impl<'s> Extend<ScalarCow<'s>> for Path<'s>
source§fn extend<T: IntoIterator<Item = ScalarCow<'s>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = ScalarCow<'s>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl Extend<ScalarCow<'static>> for Variable
impl Extend<ScalarCow<'static>> for Variable
source§fn extend<T: IntoIterator<Item = Scalar>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Scalar>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<'s> From<&'s KStringCowBase<'s>> for ScalarCow<'s>
impl<'s> From<&'s KStringCowBase<'s>> for ScalarCow<'s>
source§fn from(s: &'s KStringCow<'s>) -> Self
fn from(s: &'s KStringCow<'s>) -> Self
Converts to this type from the input type.
source§impl<'s> From<&'s KStringRef<'s>> for ScalarCow<'s>
impl<'s> From<&'s KStringRef<'s>> for ScalarCow<'s>
source§fn from(s: &'s KStringRef<'s>) -> Self
fn from(s: &'s KStringRef<'s>) -> Self
Converts to this type from the input type.
source§impl<'s> From<KStringCowBase<'s>> for ScalarCow<'s>
impl<'s> From<KStringCowBase<'s>> for ScalarCow<'s>
source§fn from(s: KStringCow<'s>) -> Self
fn from(s: KStringCow<'s>) -> Self
Converts to this type from the input type.
source§impl<'s> From<KStringRef<'s>> for ScalarCow<'s>
impl<'s> From<KStringRef<'s>> for ScalarCow<'s>
source§fn from(s: KStringRef<'s>) -> Self
fn from(s: KStringRef<'s>) -> Self
Converts to this type from the input type.
source§impl<'s> PartialEq<&'s str> for ScalarCow<'s>
impl<'s> PartialEq<&'s str> for ScalarCow<'s>
source§impl<'s> PartialEq<Date> for ScalarCow<'s>
impl<'s> PartialEq<Date> for ScalarCow<'s>
source§impl<'s> PartialEq<DateTime> for ScalarCow<'s>
impl<'s> PartialEq<DateTime> for ScalarCow<'s>
source§impl<'s> PartialEq<KStringBase<Box<str>>> for ScalarCow<'s>
impl<'s> PartialEq<KStringBase<Box<str>>> for ScalarCow<'s>
source§impl<'s> PartialEq<KStringCowBase<'s>> for ScalarCow<'s>
impl<'s> PartialEq<KStringCowBase<'s>> for ScalarCow<'s>
source§fn eq(&self, other: &KStringCow<'s>) -> bool
fn eq(&self, other: &KStringCow<'s>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<'s> PartialEq<KStringRef<'s>> for ScalarCow<'s>
impl<'s> PartialEq<KStringRef<'s>> for ScalarCow<'s>
source§fn eq(&self, other: &KStringRef<'s>) -> bool
fn eq(&self, other: &KStringRef<'s>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<'s> PartialEq<String> for ScalarCow<'s>
impl<'s> PartialEq<String> for ScalarCow<'s>
source§impl<'s> PartialEq<bool> for ScalarCow<'s>
impl<'s> PartialEq<bool> for ScalarCow<'s>
source§impl<'s> PartialEq for ScalarCow<'s>
impl<'s> PartialEq for ScalarCow<'s>
source§impl<'s> PartialOrd<Date> for ScalarCow<'s>
impl<'s> PartialOrd<Date> for ScalarCow<'s>
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<'s> PartialOrd<DateTime> for ScalarCow<'s>
impl<'s> PartialOrd<DateTime> for ScalarCow<'s>
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<'s> PartialOrd<KStringBase<Box<str>>> for ScalarCow<'s>
impl<'s> PartialOrd<KStringBase<Box<str>>> for ScalarCow<'s>
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<'s> PartialOrd<KStringCowBase<'s>> for ScalarCow<'s>
impl<'s> PartialOrd<KStringCowBase<'s>> for ScalarCow<'s>
source§fn partial_cmp(&self, other: &KStringCow<'s>) -> Option<Ordering>
fn partial_cmp(&self, other: &KStringCow<'s>) -> Option<Ordering>
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<'s> PartialOrd<KStringRef<'s>> for ScalarCow<'s>
impl<'s> PartialOrd<KStringRef<'s>> for ScalarCow<'s>
source§fn partial_cmp(&self, other: &KStringRef<'s>) -> Option<Ordering>
fn partial_cmp(&self, other: &KStringRef<'s>) -> Option<Ordering>
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<'s> PartialOrd<String> for ScalarCow<'s>
impl<'s> PartialOrd<String> for ScalarCow<'s>
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<'s> PartialOrd<bool> for ScalarCow<'s>
impl<'s> PartialOrd<bool> for ScalarCow<'s>
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<'s> PartialOrd<f32> for ScalarCow<'s>
impl<'s> PartialOrd<f32> for ScalarCow<'s>
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<'s> PartialOrd<f64> for ScalarCow<'s>
impl<'s> PartialOrd<f64> for ScalarCow<'s>
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<'s> PartialOrd<i16> for ScalarCow<'s>
impl<'s> PartialOrd<i16> for ScalarCow<'s>
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<'s> PartialOrd<i32> for ScalarCow<'s>
impl<'s> PartialOrd<i32> for ScalarCow<'s>
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<'s> PartialOrd<i64> for ScalarCow<'s>
impl<'s> PartialOrd<i64> for ScalarCow<'s>
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<'s> PartialOrd<i8> for ScalarCow<'s>
impl<'s> PartialOrd<i8> for ScalarCow<'s>
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<'s> PartialOrd<str> for ScalarCow<'s>
impl<'s> PartialOrd<str> for ScalarCow<'s>
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<'s> PartialOrd<u16> for ScalarCow<'s>
impl<'s> PartialOrd<u16> for ScalarCow<'s>
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<'s> PartialOrd<u32> for ScalarCow<'s>
impl<'s> PartialOrd<u32> for ScalarCow<'s>
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<'s> PartialOrd<u8> for ScalarCow<'s>
impl<'s> PartialOrd<u8> for ScalarCow<'s>
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<'s> PartialOrd for ScalarCow<'s>
impl<'s> PartialOrd for ScalarCow<'s>
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<'s> ValueView for ScalarCow<'s>
impl<'s> ValueView for ScalarCow<'s>
source§fn render(&self) -> DisplayCow<'_>
fn render(&self) -> DisplayCow<'_>
A
Display for a BoxedValue rendered for the user.source§fn source(&self) -> DisplayCow<'_>
fn source(&self) -> DisplayCow<'_>
A
Display for a Value as source code.source§fn query_state(&self, state: State) -> bool
fn query_state(&self, state: State) -> bool
Query the value’s state
source§fn to_kstr(&self) -> KStringCow<'_>
fn to_kstr(&self) -> KStringCow<'_>
Interpret as a string.
source§fn as_object(&self) -> Option<&dyn ObjectView>
fn as_object(&self) -> Option<&dyn ObjectView>
Extracts the object value if it is a object.
impl<'s> Eq for ScalarCow<'s>
Auto Trait Implementations§
impl<'s> Freeze for ScalarCow<'s>
impl<'s> RefUnwindSafe for ScalarCow<'s>
impl<'s> Send for ScalarCow<'s>
impl<'s> Sync for ScalarCow<'s>
impl<'s> Unpin for ScalarCow<'s>
impl<'s> UnwindSafe for ScalarCow<'s>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more