Struct cobalt::cobalt_model::DateTime
source · 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) -> DateTime
pub fn from_ymd(year: i32, month: u8, day: u8) -> DateTime
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) -> DateTime
pub fn with_offset(self, offset: UtcOffset) -> DateTime
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<DateTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DateTime, <__D as Deserializer<'de>>::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 for DateTime
impl PartialEq for DateTime
source§impl PartialOrd for DateTime
impl PartialOrd 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 Serialize for DateTime
impl Serialize for DateTime
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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 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 RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations§
§impl<V> AdhocValue for V
impl<V> AdhocValue for V
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<U> Kind for U
impl<U> Kind for U
§fn into_status<C>(self) -> Status<Self, C>where
C: Context,
fn into_status<C>(self) -> Status<Self, C>where
C: Context,
Convenience for creating an error.