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
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 ValueViewCmp<'_>
impl PartialEq<DateTime> for ValueViewCmp<'_>
Source§impl PartialOrd<DateTime> for ScalarCow<'_>
impl PartialOrd<DateTime> for ScalarCow<'_>
Source§impl PartialOrd for DateTime
impl PartialOrd for DateTime
Source§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 StructuralPartialEq for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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