Skip to main content

jiff/error/fmt/
temporal.rs

1use crate::{error, tz::Offset, util::escape};
2
3#[derive(#[automatically_derived]impl ::core::clone::Clone for Error {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self {
        match self {
            Self::AmbiguousTimeMonthDay => Error::AmbiguousTimeMonthDay,
            Self::AmbiguousTimeYearMonth => Error::AmbiguousTimeYearMonth,
            Self::CivilDateTimeZulu => Error::CivilDateTimeZulu,
            Self::ConvertDateTimeToTimestamp { offset: __self_0 } =>
                Error::ConvertDateTimeToTimestamp {
                    offset: ::core::clone::Clone::clone(__self_0),
                },
            Self::EmptyTimeZone => Error::EmptyTimeZone,
            Self::ExpectedDateDesignatorFoundByte { byte: __self_0 } =>
                Error::ExpectedDateDesignatorFoundByte {
                    byte: ::core::clone::Clone::clone(__self_0),
                },
            Self::ExpectedDateDesignatorFoundEndOfInput =>
                Error::ExpectedDateDesignatorFoundEndOfInput,
            Self::ExpectedDurationDesignatorFoundByte { byte: __self_0 } =>
                Error::ExpectedDurationDesignatorFoundByte {
                    byte: ::core::clone::Clone::clone(__self_0),
                },
            Self::ExpectedDurationDesignatorFoundEndOfInput =>
                Error::ExpectedDurationDesignatorFoundEndOfInput,
            Self::ExpectedFourDigitYear => Error::ExpectedFourDigitYear,
            Self::ExpectedNoSeparator => Error::ExpectedNoSeparator,
            Self::ExpectedOneDigitWeekday => Error::ExpectedOneDigitWeekday,
            Self::ExpectedSeparatorFoundByte { byte: __self_0 } =>
                Error::ExpectedSeparatorFoundByte {
                    byte: ::core::clone::Clone::clone(__self_0),
                },
            Self::ExpectedSeparatorFoundEndOfInput =>
                Error::ExpectedSeparatorFoundEndOfInput,
            Self::ExpectedSixDigitYear => Error::ExpectedSixDigitYear,
            Self::ExpectedTimeDesignator => Error::ExpectedTimeDesignator,
            Self::ExpectedTimeDesignatorFoundByte { byte: __self_0 } =>
                Error::ExpectedTimeDesignatorFoundByte {
                    byte: ::core::clone::Clone::clone(__self_0),
                },
            Self::ExpectedTimeDesignatorFoundEndOfInput =>
                Error::ExpectedTimeDesignatorFoundEndOfInput,
            Self::ExpectedTimeUnits => Error::ExpectedTimeUnits,
            Self::ExpectedTwoDigitDay => Error::ExpectedTwoDigitDay,
            Self::ExpectedTwoDigitHour => Error::ExpectedTwoDigitHour,
            Self::ExpectedTwoDigitMinute => Error::ExpectedTwoDigitMinute,
            Self::ExpectedTwoDigitMonth => Error::ExpectedTwoDigitMonth,
            Self::ExpectedTwoDigitSecond => Error::ExpectedTwoDigitSecond,
            Self::ExpectedTwoDigitWeekNumber =>
                Error::ExpectedTwoDigitWeekNumber,
            Self::ExpectedWeekPrefixFoundByte { byte: __self_0 } =>
                Error::ExpectedWeekPrefixFoundByte {
                    byte: ::core::clone::Clone::clone(__self_0),
                },
            Self::ExpectedWeekPrefixFoundEndOfInput =>
                Error::ExpectedWeekPrefixFoundEndOfInput,
            Self::FailedFractionalSecondInTime =>
                Error::FailedFractionalSecondInTime,
            Self::FailedOffsetNumeric => Error::FailedOffsetNumeric,
            Self::FailedSeparatorAfterMonth =>
                Error::FailedSeparatorAfterMonth,
            Self::FailedSeparatorAfterWeekNumber =>
                Error::FailedSeparatorAfterWeekNumber,
            Self::FailedSeparatorAfterYear => Error::FailedSeparatorAfterYear,
            Self::FailedTzdbLookup => Error::FailedTzdbLookup,
            Self::FailedWeekNumberPrefixInDate =>
                Error::FailedWeekNumberPrefixInDate,
            Self::InvalidDate => Error::InvalidDate,
            Self::InvalidMonthDay => Error::InvalidMonthDay,
            Self::InvalidTimeZoneUtf8 => Error::InvalidTimeZoneUtf8,
            Self::InvalidWeekDate => Error::InvalidWeekDate,
            Self::InvalidYearMonth => Error::InvalidYearMonth,
            Self::InvalidYearZero => Error::InvalidYearZero,
            Self::MissingOffsetInTimestamp => Error::MissingOffsetInTimestamp,
            Self::MissingTimeInDate => Error::MissingTimeInDate,
            Self::MissingTimeInTimestamp => Error::MissingTimeInTimestamp,
            Self::MissingTimeZoneAnnotation =>
                Error::MissingTimeZoneAnnotation,
            Self::ParseDayTwoDigit => Error::ParseDayTwoDigit,
            Self::ParseHourTwoDigit => Error::ParseHourTwoDigit,
            Self::ParseMinuteTwoDigit => Error::ParseMinuteTwoDigit,
            Self::ParseMonthTwoDigit => Error::ParseMonthTwoDigit,
            Self::ParseSecondTwoDigit => Error::ParseSecondTwoDigit,
            Self::ParseWeekNumberTwoDigit => Error::ParseWeekNumberTwoDigit,
            Self::ParseWeekdayOneDigit => Error::ParseWeekdayOneDigit,
            Self::ParseYearFourDigit => Error::ParseYearFourDigit,
            Self::ParseYearSixDigit => Error::ParseYearSixDigit,
            Self::PrintTimeZoneFailure => Error::PrintTimeZoneFailure,
        }
    }
}Clone, #[automatically_derived]impl ::core::fmt::Debug for Error {
    #[inline]
    #[rustc_trivial_field_reads]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::AmbiguousTimeMonthDay =>
                ::core::fmt::Formatter::write_str(f, "AmbiguousTimeMonthDay"),
            Self::AmbiguousTimeYearMonth =>
                ::core::fmt::Formatter::write_str(f,
                    "AmbiguousTimeYearMonth"),
            Self::CivilDateTimeZulu =>
                ::core::fmt::Formatter::write_str(f, "CivilDateTimeZulu"),
            Self::ConvertDateTimeToTimestamp { offset: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ConvertDateTimeToTimestamp offset", &__self_0),
            Self::EmptyTimeZone =>
                ::core::fmt::Formatter::write_str(f, "EmptyTimeZone"),
            Self::ExpectedDateDesignatorFoundByte { byte: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ExpectedDateDesignatorFoundByte byte", &__self_0),
            Self::ExpectedDateDesignatorFoundEndOfInput =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedDateDesignatorFoundEndOfInput"),
            Self::ExpectedDurationDesignatorFoundByte { byte: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ExpectedDurationDesignatorFoundByte byte", &__self_0),
            Self::ExpectedDurationDesignatorFoundEndOfInput =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedDurationDesignatorFoundEndOfInput"),
            Self::ExpectedFourDigitYear =>
                ::core::fmt::Formatter::write_str(f, "ExpectedFourDigitYear"),
            Self::ExpectedNoSeparator =>
                ::core::fmt::Formatter::write_str(f, "ExpectedNoSeparator"),
            Self::ExpectedOneDigitWeekday =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedOneDigitWeekday"),
            Self::ExpectedSeparatorFoundByte { byte: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ExpectedSeparatorFoundByte byte", &__self_0),
            Self::ExpectedSeparatorFoundEndOfInput =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedSeparatorFoundEndOfInput"),
            Self::ExpectedSixDigitYear =>
                ::core::fmt::Formatter::write_str(f, "ExpectedSixDigitYear"),
            Self::ExpectedTimeDesignator =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedTimeDesignator"),
            Self::ExpectedTimeDesignatorFoundByte { byte: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ExpectedTimeDesignatorFoundByte byte", &__self_0),
            Self::ExpectedTimeDesignatorFoundEndOfInput =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedTimeDesignatorFoundEndOfInput"),
            Self::ExpectedTimeUnits =>
                ::core::fmt::Formatter::write_str(f, "ExpectedTimeUnits"),
            Self::ExpectedTwoDigitDay =>
                ::core::fmt::Formatter::write_str(f, "ExpectedTwoDigitDay"),
            Self::ExpectedTwoDigitHour =>
                ::core::fmt::Formatter::write_str(f, "ExpectedTwoDigitHour"),
            Self::ExpectedTwoDigitMinute =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedTwoDigitMinute"),
            Self::ExpectedTwoDigitMonth =>
                ::core::fmt::Formatter::write_str(f, "ExpectedTwoDigitMonth"),
            Self::ExpectedTwoDigitSecond =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedTwoDigitSecond"),
            Self::ExpectedTwoDigitWeekNumber =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedTwoDigitWeekNumber"),
            Self::ExpectedWeekPrefixFoundByte { byte: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ExpectedWeekPrefixFoundByte byte", &__self_0),
            Self::ExpectedWeekPrefixFoundEndOfInput =>
                ::core::fmt::Formatter::write_str(f,
                    "ExpectedWeekPrefixFoundEndOfInput"),
            Self::FailedFractionalSecondInTime =>
                ::core::fmt::Formatter::write_str(f,
                    "FailedFractionalSecondInTime"),
            Self::FailedOffsetNumeric =>
                ::core::fmt::Formatter::write_str(f, "FailedOffsetNumeric"),
            Self::FailedSeparatorAfterMonth =>
                ::core::fmt::Formatter::write_str(f,
                    "FailedSeparatorAfterMonth"),
            Self::FailedSeparatorAfterWeekNumber =>
                ::core::fmt::Formatter::write_str(f,
                    "FailedSeparatorAfterWeekNumber"),
            Self::FailedSeparatorAfterYear =>
                ::core::fmt::Formatter::write_str(f,
                    "FailedSeparatorAfterYear"),
            Self::FailedTzdbLookup =>
                ::core::fmt::Formatter::write_str(f, "FailedTzdbLookup"),
            Self::FailedWeekNumberPrefixInDate =>
                ::core::fmt::Formatter::write_str(f,
                    "FailedWeekNumberPrefixInDate"),
            Self::InvalidDate =>
                ::core::fmt::Formatter::write_str(f, "InvalidDate"),
            Self::InvalidMonthDay =>
                ::core::fmt::Formatter::write_str(f, "InvalidMonthDay"),
            Self::InvalidTimeZoneUtf8 =>
                ::core::fmt::Formatter::write_str(f, "InvalidTimeZoneUtf8"),
            Self::InvalidWeekDate =>
                ::core::fmt::Formatter::write_str(f, "InvalidWeekDate"),
            Self::InvalidYearMonth =>
                ::core::fmt::Formatter::write_str(f, "InvalidYearMonth"),
            Self::InvalidYearZero =>
                ::core::fmt::Formatter::write_str(f, "InvalidYearZero"),
            Self::MissingOffsetInTimestamp =>
                ::core::fmt::Formatter::write_str(f,
                    "MissingOffsetInTimestamp"),
            Self::MissingTimeInDate =>
                ::core::fmt::Formatter::write_str(f, "MissingTimeInDate"),
            Self::MissingTimeInTimestamp =>
                ::core::fmt::Formatter::write_str(f,
                    "MissingTimeInTimestamp"),
            Self::MissingTimeZoneAnnotation =>
                ::core::fmt::Formatter::write_str(f,
                    "MissingTimeZoneAnnotation"),
            Self::ParseDayTwoDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseDayTwoDigit"),
            Self::ParseHourTwoDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseHourTwoDigit"),
            Self::ParseMinuteTwoDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseMinuteTwoDigit"),
            Self::ParseMonthTwoDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseMonthTwoDigit"),
            Self::ParseSecondTwoDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseSecondTwoDigit"),
            Self::ParseWeekNumberTwoDigit =>
                ::core::fmt::Formatter::write_str(f,
                    "ParseWeekNumberTwoDigit"),
            Self::ParseWeekdayOneDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseWeekdayOneDigit"),
            Self::ParseYearFourDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseYearFourDigit"),
            Self::ParseYearSixDigit =>
                ::core::fmt::Formatter::write_str(f, "ParseYearSixDigit"),
            Self::PrintTimeZoneFailure =>
                ::core::fmt::Formatter::write_str(f, "PrintTimeZoneFailure"),
        }
    }
}Debug)]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5pub(crate) enum Error {
6    #[cfg(not(feature = "alloc"))]
7    AllocPosixTimeZone,
8    AmbiguousTimeMonthDay,
9    AmbiguousTimeYearMonth,
10    CivilDateTimeZulu,
11    ConvertDateTimeToTimestamp {
12        offset: Offset,
13    },
14    EmptyTimeZone,
15    ExpectedDateDesignatorFoundByte {
16        byte: u8,
17    },
18    ExpectedDateDesignatorFoundEndOfInput,
19    ExpectedDurationDesignatorFoundByte {
20        byte: u8,
21    },
22    ExpectedDurationDesignatorFoundEndOfInput,
23    ExpectedFourDigitYear,
24    ExpectedNoSeparator,
25    ExpectedOneDigitWeekday,
26    ExpectedSeparatorFoundByte {
27        byte: u8,
28    },
29    ExpectedSeparatorFoundEndOfInput,
30    ExpectedSixDigitYear,
31    ExpectedTimeDesignator,
32    ExpectedTimeDesignatorFoundByte {
33        byte: u8,
34    },
35    ExpectedTimeDesignatorFoundEndOfInput,
36    ExpectedTimeUnits,
37    ExpectedTwoDigitDay,
38    ExpectedTwoDigitHour,
39    ExpectedTwoDigitMinute,
40    ExpectedTwoDigitMonth,
41    ExpectedTwoDigitSecond,
42    ExpectedTwoDigitWeekNumber,
43    ExpectedWeekPrefixFoundByte {
44        byte: u8,
45    },
46    ExpectedWeekPrefixFoundEndOfInput,
47    FailedFractionalSecondInTime,
48    FailedOffsetNumeric,
49    FailedSeparatorAfterMonth,
50    FailedSeparatorAfterWeekNumber,
51    FailedSeparatorAfterYear,
52    FailedTzdbLookup,
53    FailedWeekNumberPrefixInDate,
54    InvalidDate,
55    InvalidMonthDay,
56    InvalidTimeZoneUtf8,
57    InvalidWeekDate,
58    InvalidYearMonth,
59    InvalidYearZero,
60    MissingOffsetInTimestamp,
61    MissingTimeInDate,
62    MissingTimeInTimestamp,
63    MissingTimeZoneAnnotation,
64    ParseDayTwoDigit,
65    ParseHourTwoDigit,
66    ParseMinuteTwoDigit,
67    ParseMonthTwoDigit,
68    ParseSecondTwoDigit,
69    ParseWeekNumberTwoDigit,
70    ParseWeekdayOneDigit,
71    ParseYearFourDigit,
72    ParseYearSixDigit,
73    // This is the only error for formatting a Temporal value. And
74    // actually, it's not even part of Temporal, but just lives in that
75    // module (for convenience reasons).
76    PrintTimeZoneFailure,
77}
78
79impl error::IntoError for Error {
80    fn into_error(self) -> error::Error {
81        self.into()
82    }
83}
84
85impl From<Error> for error::Error {
86    #[cold]
87    #[inline(never)]
88    fn from(err: Error) -> error::Error {
89        error::ErrorKind::FmtTemporal(err).into()
90    }
91}
92
93impl core::fmt::Display for Error {
94    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
95        use self::Error::*;
96
97        match *self {
98            #[cfg(not(feature = "alloc"))]
99            AllocPosixTimeZone => f.write_str(
100                "cannot parsed time zones other than IANA time zone \
101                 identifiers or fixed offsets \
102                 without the `alloc` crate feature enabled for `jiff`",
103            ),
104            AmbiguousTimeMonthDay => {
105                f.write_str("parsed time is ambiguous with a month-day date")
106            }
107            AmbiguousTimeYearMonth => {
108                f.write_str("parsed time is ambiguous with a year-month date")
109            }
110            CivilDateTimeZulu => f.write_str(
111                "cannot parse civil date/time from string with a Zulu \
112                 offset, parse as a `jiff::Timestamp` first \
113                 and convert to a civil date/time instead",
114            ),
115            ConvertDateTimeToTimestamp { offset } => f.write_fmt(format_args!("failed to convert civil datetime to timestamp with offset {0}",
        offset))write!(
116                f,
117                "failed to convert civil datetime to timestamp \
118                 with offset {offset}",
119            ),
120            EmptyTimeZone => {
121                f.write_str("an empty string is not a valid time zone")
122            }
123            ExpectedDateDesignatorFoundByte { byte } => f.write_fmt(format_args!("expected to find date unit designator suffix (`Y`, `M`, `W` or `D`), but found `{0}` instead",
        escape::Byte(byte)))write!(
124                f,
125                "expected to find date unit designator suffix \
126                 (`Y`, `M`, `W` or `D`), but found `{byte}` instead",
127                byte = escape::Byte(byte),
128            ),
129            ExpectedDateDesignatorFoundEndOfInput => f.write_str(
130                "expected to find date unit designator suffix \
131                 (`Y`, `M`, `W` or `D`), but found end of input",
132            ),
133            ExpectedDurationDesignatorFoundByte { byte } => f.write_fmt(format_args!("expected to find duration beginning with `P` or `p`, but found `{0}` instead",
        escape::Byte(byte)))write!(
134                f,
135                "expected to find duration beginning with `P` or `p`, \
136                 but found `{byte}` instead",
137                byte = escape::Byte(byte),
138            ),
139            ExpectedDurationDesignatorFoundEndOfInput => f.write_str(
140                "expected to find duration beginning with `P` or `p`, \
141                 but found end of input",
142            ),
143            ExpectedFourDigitYear => f.write_str(
144                "expected four digit year (or leading sign for \
145                 six digit year), but found end of input",
146            ),
147            ExpectedNoSeparator => f.write_str(
148                "expected no separator since none was \
149                 found after the year, but found a `-` separator",
150            ),
151            ExpectedOneDigitWeekday => f.write_str(
152                "expected one digit weekday, but found end of input",
153            ),
154            ExpectedSeparatorFoundByte { byte } => f.write_fmt(format_args!("expected `-` separator, but found `{0}`",
        escape::Byte(byte)))write!(
155                f,
156                "expected `-` separator, but found `{byte}`",
157                byte = escape::Byte(byte),
158            ),
159            ExpectedSeparatorFoundEndOfInput => {
160                f.write_str("expected `-` separator, but found end of input")
161            }
162            ExpectedSixDigitYear => f.write_str(
163                "expected six digit year (because of a leading sign), \
164                 but found end of input",
165            ),
166            ExpectedTimeDesignator => f.write_str(
167                "parsing ISO 8601 duration in this context requires \
168                 that the duration contain a time component and no \
169                 components of days or greater",
170            ),
171            ExpectedTimeDesignatorFoundByte { byte } => f.write_fmt(format_args!("expected to find time unit designator suffix (`H`, `M` or `S`), but found `{0}` instead",
        escape::Byte(byte)))write!(
172                f,
173                "expected to find time unit designator suffix \
174                 (`H`, `M` or `S`), but found `{byte}` instead",
175                byte = escape::Byte(byte),
176            ),
177            ExpectedTimeDesignatorFoundEndOfInput => f.write_str(
178                "expected to find time unit designator suffix \
179                 (`H`, `M` or `S`), but found end of input",
180            ),
181            ExpectedTimeUnits => f.write_str(
182                "found a time designator (`T` or `t`) in an ISO 8601 \
183                 duration string, but did not find any time units",
184            ),
185            ExpectedTwoDigitDay => {
186                f.write_str("expected two digit day, but found end of input")
187            }
188            ExpectedTwoDigitHour => {
189                f.write_str("expected two digit hour, but found end of input")
190            }
191            ExpectedTwoDigitMinute => f.write_str(
192                "expected two digit minute, but found end of input",
193            ),
194            ExpectedTwoDigitMonth => {
195                f.write_str("expected two digit month, but found end of input")
196            }
197            ExpectedTwoDigitSecond => f.write_str(
198                "expected two digit second, but found end of input",
199            ),
200            ExpectedTwoDigitWeekNumber => f.write_str(
201                "expected two digit week number, but found end of input",
202            ),
203            ExpectedWeekPrefixFoundByte { byte } => f.write_fmt(format_args!("expected `W` or `w`, but found `{0}` instead",
        escape::Byte(byte)))write!(
204                f,
205                "expected `W` or `w`, but found `{byte}` instead",
206                byte = escape::Byte(byte),
207            ),
208            ExpectedWeekPrefixFoundEndOfInput => {
209                f.write_str("expected `W` or `w`, but found end of input")
210            }
211            FailedFractionalSecondInTime => {
212                f.write_str("failed to parse fractional seconds in time")
213            }
214            FailedOffsetNumeric => f.write_str(
215                "offset successfully parsed, \
216                 but failed to convert to numeric `jiff::tz::Offset`",
217            ),
218            FailedSeparatorAfterMonth => {
219                f.write_str("failed to parse separator after month")
220            }
221            FailedSeparatorAfterWeekNumber => {
222                f.write_str("failed to parse separator after week number")
223            }
224            FailedSeparatorAfterYear => {
225                f.write_str("failed to parse separator after year")
226            }
227            FailedTzdbLookup => f.write_str(
228                "parsed apparent IANA time zone identifier, \
229                 but the tzdb lookup failed",
230            ),
231            FailedWeekNumberPrefixInDate => {
232                f.write_str("failed to parse week number prefix in date")
233            }
234            InvalidDate => f.write_str("parsed date is not valid"),
235            InvalidMonthDay => f.write_str("parsed month-day is not valid"),
236            InvalidTimeZoneUtf8 => f.write_str(
237                "found plausible IANA time zone identifier, \
238                 but it is not valid UTF-8",
239            ),
240            InvalidWeekDate => f.write_str("parsed week date is not valid"),
241            InvalidYearMonth => f.write_str("parsed year-month is not valid"),
242            InvalidYearZero => f.write_str(
243                "year zero must be written without a sign or a \
244                 positive sign, but not a negative sign",
245            ),
246            MissingOffsetInTimestamp => f.write_str(
247                "failed to find offset component, \
248                 which is required for parsing a timestamp",
249            ),
250            MissingTimeInDate => f.write_str(
251                "successfully parsed date, but no time component was found",
252            ),
253            MissingTimeInTimestamp => f.write_str(
254                "failed to find time component, \
255                 which is required for parsing a timestamp",
256            ),
257            MissingTimeZoneAnnotation => f.write_str(
258                "failed to find time zone annotation in square brackets, \
259                 which is required for parsing a zoned datetime",
260            ),
261            ParseDayTwoDigit => {
262                f.write_str("failed to parse two digit integer as day")
263            }
264            ParseHourTwoDigit => {
265                f.write_str("failed to parse two digit integer as hour")
266            }
267            ParseMinuteTwoDigit => {
268                f.write_str("failed to parse two digit integer as minute")
269            }
270            ParseMonthTwoDigit => {
271                f.write_str("failed to parse two digit integer as month")
272            }
273            ParseSecondTwoDigit => {
274                f.write_str("failed to parse two digit integer as second")
275            }
276            ParseWeekNumberTwoDigit => {
277                f.write_str("failed to parse two digit integer as week number")
278            }
279            ParseWeekdayOneDigit => {
280                f.write_str("failed to parse one digit integer as weekday")
281            }
282            ParseYearFourDigit => {
283                f.write_str("failed to parse four digit integer as year")
284            }
285            ParseYearSixDigit => {
286                f.write_str("failed to parse six digit integer as year")
287            }
288            PrintTimeZoneFailure => f.write_str(
289                "time zones without IANA identifiers that aren't either \
290                 fixed offsets or a POSIX time zone can't be serialized \
291                 (this typically occurs when this is a system time zone \
292                  derived from `/etc/localtime` on Unix systems that \
293                  isn't symlinked to an entry in `/usr/share/zoneinfo`)",
294            ),
295        }
296    }
297}