pub enum Time {
Relative(Relative),
Weekday(Weekday),
Month(Month),
Exact(ExactDateTime),
DateTime(DateTime<Utc>),
}Expand description
A time representation supporting relative, named, exact, and absolute forms.
Serialises as an untagged enum, allowing natural JSON representations like
"Today", "Monday", "2025-07-29T10:30:05Z", etc.
Variants§
Implementations§
Source§impl Time
impl Time
Sourcepub fn to_chrono_min_now(self) -> DateTime<Utc>
pub fn to_chrono_min_now(self) -> DateTime<Utc>
Converts to the earliest possible timestamp, relative to the current time.
Sourcepub fn to_chrono_min(self, relative_to: DateTime<Utc>) -> DateTime<Utc>
pub fn to_chrono_min(self, relative_to: DateTime<Utc>) -> DateTime<Utc>
Converts to the earliest possible timestamp, relative to the given time.
Sourcepub fn to_chrono_max_now(self) -> DateTime<Utc>
pub fn to_chrono_max_now(self) -> DateTime<Utc>
Converts to the latest possible timestamp, relative to the current time.
Sourcepub fn to_chrono_max(self, relative_to: DateTime<Utc>) -> DateTime<Utc>
pub fn to_chrono_max(self, relative_to: DateTime<Utc>) -> DateTime<Utc>
Converts to the latest possible timestamp, relative to the given time.
Sourcepub fn from_max_chrono(
date_time: DateTime<Utc>,
relative_to: Option<DateTime<Utc>>,
language: Language,
) -> Time
pub fn from_max_chrono( date_time: DateTime<Utc>, relative_to: Option<DateTime<Utc>>, language: Language, ) -> Time
Converts a chrono timestamp to the most natural time representation.
When relative_to is provided, attempts to express the timestamp as a relative
or named time (e.g., “Today”, “Monday”) in the specified language.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
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
impl Eq for Time
Source§impl JsonSchema for Time
impl JsonSchema for Time
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for Time
Auto Trait Implementations§
impl Forget for Time
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnsafeUnpin for Time
impl UnwindSafe for Time
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