pub enum DateTimeError {
InvalidFormat,
InvalidTimezone,
InvalidDate,
InvalidTime,
ParseError(Parse),
ComponentRange(ComponentRange),
}
Expand description
Custom error type for the DateTime
library.
This enum represents various errors that can occur when working with
DateTime
objects, such as invalid formats, timezones, and component ranges.
Variants§
InvalidFormat
The provided date format is invalid.
InvalidTimezone
The provided timezone is invalid or not supported. DST is not supported.
InvalidDate
The date is invalid (e.g., February 30).
InvalidTime
The time is invalid (e.g., 25:00).
ParseError(Parse)
An error occurred while parsing the date/time string.
ComponentRange(ComponentRange)
A component (year, month, day, etc.) is out of the valid range.
Trait Implementations§
Source§impl Clone for DateTimeError
impl Clone for DateTimeError
Source§fn clone(&self) -> DateTimeError
fn clone(&self) -> DateTimeError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DateTimeError
impl Debug for DateTimeError
Source§impl Default for DateTimeError
impl Default for DateTimeError
Source§impl<'de> Deserialize<'de> for DateTimeError
impl<'de> Deserialize<'de> for DateTimeError
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>,
Deserializes a string into a DateTimeError
.
This is a custom implementation to handle deserialization for variants
that contain types (Parse
and ComponentRange
) which do not implement
Deserialize
.
§Errors
This function will return a deserialization error if the input string does not match any of the known variants.
Source§impl Display for DateTimeError
impl Display for DateTimeError
Source§impl Error for DateTimeError
impl Error for DateTimeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<ComponentRange> for DateTimeError
impl From<ComponentRange> for DateTimeError
Source§impl From<DateTimeError> for AppError
impl From<DateTimeError> for AppError
Source§fn from(source: DateTimeError) -> Self
fn from(source: DateTimeError) -> Self
Source§impl From<Parse> for DateTimeError
impl From<Parse> for DateTimeError
Source§impl Hash for DateTimeError
impl Hash for DateTimeError
Source§impl PartialEq for DateTimeError
impl PartialEq for DateTimeError
Source§impl Serialize for DateTimeError
impl Serialize for DateTimeError
Source§fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
Serializes the DateTimeError
into a string representation.
This is a custom implementation to handle serialization for variants
that contain types (Parse
and ComponentRange
) which do not implement
Serialize
.
§Errors
This function will return a serialization error if the process fails.