Skip to main content

DtErrKind

Enum DtErrKind 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum DtErrKind {
Show 85 variants UnexpectedEnd = 0, TruncatedDirective = 1, UnknownItem = 2, MissingFeature = 3, MissingRefTimeOrStd = 4, MustStartWith = 5, UnsupportedItem = 6, MismatchedLiteral = 7, ExpectedUnit = 8, ExpectedValue = 9, ExpectedYear = 10, ExpectedCentury = 11, ExpectedMonth = 12, ExpectedDay = 13, ExpectedDayOfYear = 14, ExpectedHour = 15, ExpectedMinute = 16, ExpectedSecond = 17, ExpectedFractional = 18, ExpectedTimestamp = 19, ExpectedWeekNumber = 20, ExpectedWeekdayNumber = 21, ExpectedDigits = 22, ExpectedMonWeekday = 23, ExpectedSunWeekday = 24, ExpectedMonWeek = 25, ExpectedSunWeek = 26, MonWeekdayOutOfRange = 27, SunWeekdayOutOfRange = 28, InvalidCodeId = 29, NonMonotonic = 30, TFieldTooShort = 31, PFieldTooShort = 32, InvalidSubmillisecond = 33, InvalidWeekdayName = 34, InvalidMonthName = 35, InvalidMeridiem = 36, InvalidScale = 37, InvalidDate = 38, InvalidTime = 39, InvalidYear = 40, InvalidMonth = 41, InvalidDay = 42, InvalidDayOfYear = 43, InvalidIsoWeekYear = 44, InvalidIsoWeek = 45, InvalidSunWeek = 46, InvalidMonWeek = 47, InvalidHour = 48, InvalidMinute = 49, InvalidSecond = 50, InvalidFractional = 51, InvalidTimestamp = 52, InvalidName = 53, InvalidTimeZone = 54, OffsetMissingSign = 55, InvalidOffsetHour = 56, InvalidOffsetMinute = 57, InvalidOffsetSecond = 58, InvalidOffsetColons = 59, InvalidOffset = 60, InvalidNumber = 61, InvalidItem = 62, InvalidBytes = 63, InvalidSyntax = 64, OutOfRange = 65, MonthOutOfRange = 66, DayOutOfRange = 67, DayOfYearOutOfRange = 68, HourOutOfRange = 69, MinuteOutOfRange = 70, SecondOutOfRange = 71, WeekOutOfRange = 72, IsoWeekOutOfRange = 73, YearOutOfRange = 74, FracOutOfRange = 75, MjdOutOfRange = 76, TrailingCharacters = 77, Incomplete = 78, InvalidInput = 79, InvalidLen = 80, InternalErr = 81, ConversionFail = 82, IOErr = 83, Empty = 84,
}
Expand description

The kind of error returned by deep-time.

Almost every function in this crate that can fail returns a DtErr. That error is made of two parts:

  1. A kind — one of the variants of this enum (what went wrong).
  2. A short reason string — optional extra detail (up to 15 bytes).

Those two pieces live inside AnErr. DtErr is simply AnErr<DtErrKind, 15> — the whole error is 16 bytes.

Create one with the an_err! macro, and read the kind back with .kind():

use deep_time::{DtErr, DtErrKind, an_err};

let err: DtErr = an_err!(DtErrKind::YearOutOfRange, "year={}", 10_000);
assert_eq!(err.kind(), DtErrKind::YearOutOfRange);

When printed, an error looks like YearOutOfRange or YearOutOfRange: year=10000.

This enum is marked #[non_exhaustive], so new variants may be added in later releases. Always keep a catch-all arm (_ => ...) when matching.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

UnexpectedEnd = 0

§

TruncatedDirective = 1

§

UnknownItem = 2

§

MissingFeature = 3

§

MissingRefTimeOrStd = 4

§

MustStartWith = 5

§

UnsupportedItem = 6

§

MismatchedLiteral = 7

§

ExpectedUnit = 8

§

ExpectedValue = 9

§

ExpectedYear = 10

§

ExpectedCentury = 11

§

ExpectedMonth = 12

§

ExpectedDay = 13

§

ExpectedDayOfYear = 14

§

ExpectedHour = 15

§

ExpectedMinute = 16

§

ExpectedSecond = 17

§

ExpectedFractional = 18

§

ExpectedTimestamp = 19

§

ExpectedWeekNumber = 20

§

ExpectedWeekdayNumber = 21

§

ExpectedDigits = 22

§

ExpectedMonWeekday = 23

§

ExpectedSunWeekday = 24

§

ExpectedMonWeek = 25

§

ExpectedSunWeek = 26

§

MonWeekdayOutOfRange = 27

§

SunWeekdayOutOfRange = 28

§

InvalidCodeId = 29

§

NonMonotonic = 30

§

TFieldTooShort = 31

§

PFieldTooShort = 32

§

InvalidSubmillisecond = 33

§

InvalidWeekdayName = 34

§

InvalidMonthName = 35

§

InvalidMeridiem = 36

§

InvalidScale = 37

§

InvalidDate = 38

§

InvalidTime = 39

§

InvalidYear = 40

§

InvalidMonth = 41

§

InvalidDay = 42

§

InvalidDayOfYear = 43

§

InvalidIsoWeekYear = 44

§

InvalidIsoWeek = 45

§

InvalidSunWeek = 46

§

InvalidMonWeek = 47

§

InvalidHour = 48

§

InvalidMinute = 49

§

InvalidSecond = 50

§

InvalidFractional = 51

§

InvalidTimestamp = 52

§

InvalidName = 53

§

InvalidTimeZone = 54

§

OffsetMissingSign = 55

§

InvalidOffsetHour = 56

§

InvalidOffsetMinute = 57

§

InvalidOffsetSecond = 58

§

InvalidOffsetColons = 59

§

InvalidOffset = 60

§

InvalidNumber = 61

§

InvalidItem = 62

§

InvalidBytes = 63

§

InvalidSyntax = 64

§

OutOfRange = 65

§

MonthOutOfRange = 66

§

DayOutOfRange = 67

§

DayOfYearOutOfRange = 68

§

HourOutOfRange = 69

§

MinuteOutOfRange = 70

§

SecondOutOfRange = 71

§

WeekOutOfRange = 72

§

IsoWeekOutOfRange = 73

§

YearOutOfRange = 74

§

FracOutOfRange = 75

§

MjdOutOfRange = 76

§

TrailingCharacters = 77

§

Incomplete = 78

§

InvalidInput = 79

§

InvalidLen = 80

§

InternalErr = 81

§

ConversionFail = 82

§

IOErr = 83

§

Empty = 84

Trait Implementations§

Source§

impl Clone for DtErrKind

Source§

fn clone(&self) -> DtErrKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DtErrKind

Source§

impl Debug for DtErrKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DtErrKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for DtErrKind

Source§

impl Format for DtErrKind

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for DtErrKind

Source§

fn eq(&self, other: &DtErrKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DtErrKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DtErrKind

Source§

impl Tsify for DtErrKind

Source§

const DECL: &'static str = "/**\n * The kind of error returned by deep-time.\n *\n * Almost every function in this crate that can fail returns a\n * [`DtErr`](type.DtErr.html). That error is made of two parts:\n *\n * 1. A **kind** \u{2014} one of the variants of this enum (what went wrong).\n * 2. A short **reason** string \u{2014} optional extra detail (up to 15 bytes).\n *\n * Those two pieces live inside [`AnErr`](struct.AnErr.html). [`DtErr`](type.DtErr.html)\n * is simply `AnErr<DtErrKind, 15>` \u{2014} the whole error is 16 bytes.\n *\n * Create one with the [`an_err!`](macro.an_err!.html) macro, and read the kind\n * back with [`.kind()`](struct.AnErr.html#method.kind):\n *\n * ```\n * use deep_time::{DtErr, DtErrKind, an_err};\n *\n * let err: DtErr = an_err!(DtErrKind::YearOutOfRange, \\\"year={}\\\", 10_000);\n * assert_eq!(err.kind(), DtErrKind::YearOutOfRange);\n * ```\n *\n * When printed, an error looks like `YearOutOfRange` or\n * `YearOutOfRange: year=10000`.\n *\n * This enum is marked `#[non_exhaustive]`, so new variants may be added in\n * later releases. Always keep a catch-all arm (`_ => ...`) when matching.\n */\nexport type DtErrKind = \"UnexpectedEnd\" | \"TruncatedDirective\" | \"UnknownItem\" | \"MissingFeature\" | \"MissingRefTimeOrStd\" | \"MustStartWith\" | \"UnsupportedItem\" | \"MismatchedLiteral\" | \"ExpectedUnit\" | \"ExpectedValue\" | \"ExpectedYear\" | \"ExpectedCentury\" | \"ExpectedMonth\" | \"ExpectedDay\" | \"ExpectedDayOfYear\" | \"ExpectedHour\" | \"ExpectedMinute\" | \"ExpectedSecond\" | \"ExpectedFractional\" | \"ExpectedTimestamp\" | \"ExpectedWeekNumber\" | \"ExpectedWeekdayNumber\" | \"ExpectedDigits\" | \"ExpectedMonWeekday\" | \"ExpectedSunWeekday\" | \"ExpectedMonWeek\" | \"ExpectedSunWeek\" | \"MonWeekdayOutOfRange\" | \"SunWeekdayOutOfRange\" | \"InvalidCodeId\" | \"NonMonotonic\" | \"TFieldTooShort\" | \"PFieldTooShort\" | \"InvalidSubmillisecond\" | \"InvalidWeekdayName\" | \"InvalidMonthName\" | \"InvalidMeridiem\" | \"InvalidScale\" | \"InvalidDate\" | \"InvalidTime\" | \"InvalidYear\" | \"InvalidMonth\" | \"InvalidDay\" | \"InvalidDayOfYear\" | \"InvalidIsoWeekYear\" | \"InvalidIsoWeek\" | \"InvalidSunWeek\" | \"InvalidMonWeek\" | \"InvalidHour\" | \"InvalidMinute\" | \"InvalidSecond\" | \"InvalidFractional\" | \"InvalidTimestamp\" | \"InvalidName\" | \"InvalidTimeZone\" | \"OffsetMissingSign\" | \"InvalidOffsetHour\" | \"InvalidOffsetMinute\" | \"InvalidOffsetSecond\" | \"InvalidOffsetColons\" | \"InvalidOffset\" | \"InvalidNumber\" | \"InvalidItem\" | \"InvalidBytes\" | \"InvalidSyntax\" | \"OutOfRange\" | \"MonthOutOfRange\" | \"DayOutOfRange\" | \"DayOfYearOutOfRange\" | \"HourOutOfRange\" | \"MinuteOutOfRange\" | \"SecondOutOfRange\" | \"WeekOutOfRange\" | \"IsoWeekOutOfRange\" | \"YearOutOfRange\" | \"FracOutOfRange\" | \"MjdOutOfRange\" | \"TrailingCharacters\" | \"Incomplete\" | \"InvalidInput\" | \"InvalidLen\" | \"InternalErr\" | \"ConversionFail\" | \"IOErr\" | \"Empty\";"

Source§

const SERIALIZATION_CONFIG: SerializationConfig

Source§

type JsType = JsType

Source§

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

Source§

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more