Struct cobalt_config::DateTime
source · [−]#[repr(transparent)]pub struct DateTime { /* private fields */ }
Expand description
Liquid’s native date + time type.
Implementations
sourceimpl 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 = Date::__from_ordinal_date_unchecked(1970, 1).midnight().assume_utc()
Trait Implementations
sourceimpl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
sourcefn 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
sourceimpl Ord for DateTime
impl Ord for DateTime
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<DateTime> for DateTime
impl PartialEq<DateTime> for DateTime
sourceimpl PartialOrd<DateTime> for DateTime
impl PartialOrd<DateTime> for DateTime
sourcefn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
fn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl Serialize for DateTime
impl Serialize for DateTime
sourcefn 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
sourceimpl ValueView for DateTime
impl ValueView for DateTime
sourcefn render(&self) -> DisplayCow<'_>
fn render(&self) -> DisplayCow<'_>
A Display
for a BoxedValue
rendered for the user.
sourcefn source(&self) -> DisplayCow<'_>
fn source(&self) -> DisplayCow<'_>
A Display
for a Value
as source code.
sourcefn query_state(&self, state: State) -> bool
fn query_state(&self, state: State) -> bool
Query the value’s state
sourcefn 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
sourceimpl<V> AdhocValue for V where
V: 'static + Clone + Display + Debug + Send + Sync,
impl<V> AdhocValue for V where
V: 'static + Clone + Display + Debug + Send + Sync,
sourcefn clone_box(&self) -> Box<dyn AdhocValue + 'static, Global>
fn clone_box(&self) -> Box<dyn AdhocValue + 'static, Global>
Clone the value
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.