Struct liquid_core::model::DateTime
source · #[repr(transparent)]pub struct DateTime { /* private fields */ }
Expand description
Liquid’s native date + time type.
Implementations§
source§impl DateTime
impl DateTime
sourcepub fn from_ymd(year: i32, month: u8, day: u8) -> Self
pub fn from_ymd(year: i32, month: u8, day: u8) -> Self
Makes a new NaiveDate from the calendar date (year, month and day).
Panics on the out-of-range date, invalid month and/or day.
sourcepub fn with_offset(self, offset: UtcOffset) -> Self
pub fn with_offset(self, offset: UtcOffset) -> Self
Changes the associated time zone. This does not change the actual DateTime (but will change the string representation).
sourcepub fn format(&self, fmt: &str) -> Result<String, DateFormatError>
pub fn format(&self, fmt: &str) -> Result<String, DateFormatError>
Formats the combined date and time with the specified format string.
See the chrono::format::strftime module on the supported escape sequences.
sourcepub fn to_rfc2822(&self) -> String
pub fn to_rfc2822(&self) -> String
Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200
.
Methods from Deref<Target = OffsetDateTime>§
pub const UNIX_EPOCH: OffsetDateTime = Self(Inner::UNIX_EPOCH)
Trait Implementations§
source§impl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
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 Ord for DateTime
impl Ord for DateTime
source§impl PartialEq<DateTime> for DateTime
impl PartialEq<DateTime> for DateTime
source§impl<'s> PartialEq<DateTime> for ScalarCow<'s>
impl<'s> PartialEq<DateTime> for ScalarCow<'s>
source§impl PartialEq<DateTime> for Value
impl PartialEq<DateTime> for Value
source§impl<'v> PartialEq<DateTime> for ValueCow<'v>
impl<'v> PartialEq<DateTime> for ValueCow<'v>
source§impl<'v> PartialEq<DateTime> for ValueViewCmp<'v>
impl<'v> PartialEq<DateTime> for ValueViewCmp<'v>
source§impl PartialOrd<DateTime> for DateTime
impl PartialOrd<DateTime> for DateTime
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 ValueView for DateTime
impl ValueView for DateTime
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 Copy for DateTime
impl Eq for DateTime
impl StructuralEq for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations§
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
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