Skip to main content

deep_time/
error.rs

1//! [`DtErrKind`] and main error type [`DtErr`].
2//!
3//! [`DtErr`] is a type alias to [`AnErr`] — a compact,
4//! zero-allocation error that supports chaining with
5//! source locations and short per-level reasons.
6
7use crate::AnErr;
8
9#[non_exhaustive]
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum DtErrKind {
12    UnexpectedEnd,
13    UnexpectedInputEnd,
14    TruncatedDirective,
15    UnknownItem,
16    UnsupportedItem,
17    BadFractional,
18    MismatchedLiteral,
19    ExpectedValue,
20    ExpectedYear,
21    ExpectedCentury,
22    ExpectedMonth,
23    ExpectedDay,
24    ExpectedDayOfYear,
25    ExpectedHour,
26    ExpectedMinute,
27    ExpectedSecond,
28    ExpectedFractionalSeconds,
29    ExpectedTimestamp,
30    ExpectedWeekNumber,
31    ExpectedWeekdayNumber,
32    InvalidName,
33    InvalidTimezoneOffset,
34    MustStartWith,
35    InvalidNumber,
36    InvalidItem,
37    InvalidBytes,
38    InvalidSyntax,
39    OutOfRange,
40    TrailingCharacters,
41    Incomplete,
42    InvalidInput,
43    InternalErr,
44    IOErr,
45}
46
47/// Wrapper around [`AnErr`].
48///
49/// A [`DtErr`] object is 120 bytes.
50pub type DtErr = AnErr<DtErrKind, 2, 49>;