Skip to main content

ErrorKind

Enum ErrorKind 

Source
#[non_exhaustive]
pub enum ErrorKind { Io, NotAgs4, BadDictionary, Emit, InvalidArgument, Other, TypeConflict, UnitConflict, MissingTran, }
Expand description

What went wrong, coarsely.

#[non_exhaustive] because this list will grow: a consumer must be able to keep compiling when it does. Match with a _ arm, or use Error::kind_str if you are routing on the string.

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.
§

Io

The file could not be read, written, or found.

§

NotAgs4

The bytes are not AGS4 — structurally unparseable, not merely invalid.

§

BadDictionary

A dictionary or edition was requested that does not exist or does not parse.

§

Emit

The data could not be written as valid AGS4.

§

InvalidArgument

A caller argument was wrong — an unknown group code, a row index out of range, an encoding label nothing recognises.

§

Other

Something the engine reported that this crate does not classify.

Not dead weight: the engine names its error kinds as strings and is the single producer of that domain, so it can add one without this crate changing. Mapping such a token onto whichever existing kind looked closest would be a confident wrong answer; this is the honest one. It carries the engine’s own message.

§

TypeConflict

Two files being merged declare different AGS TYPEs for one heading, and no resolution was chosen.

Its own kind rather than ErrorKind::InvalidArgument because the caller CAN settle it — ags4::Merge::on_type_clash widens the column to X or promotes it to the greatest nDP precision. The Python, Node and lat surfaces draw the same distinction under the same type_conflict token.

§

UnitConflict

Two files being merged declare different UNITs for one heading.

Separate from ErrorKind::TypeConflict because it is fatal in every mode and the two need different fixes: no resolution absorbs a unit disagreement, since picking one would silently mislabel the other file’s values. Reconcile the UNIT row in the sources.

§

MissingTran

A merge was asked to refuse when no transmission stamp is supplied (ags4::MissingTran::Refuse) and none was.

Its own kind rather than ErrorKind::InvalidArgument for the same reason the two above are: it is a merge refusal, it shares their exit code, and a caller routing on kind_str() should be able to tell which of merge’s three refusals it hit — they need three different fixes.

Implementations§

Source§

impl ErrorKind

Source

pub fn as_str(self) -> &'static str

The stable wire token for this kind.

Shared verbatim with the Python, Node and lat surfaces, which is what makes it worth freezing: a tool that routes on laterite’s error strings gets the same tokens whichever binding produced them. These strings are part of the public API and will not change under a consumer.

Source

pub fn exit_code(self) -> i32

The process exit code lat uses for this kind, so a wrapper binary can exit the same way without restating the mapping.

Trait Implementations§

Source§

impl Clone for ErrorKind

Source§

fn clone(&self) -> ErrorKind

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 ErrorKind

Source§

impl Debug for ErrorKind

Source§

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

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

impl Eq for ErrorKind

Source§

impl Hash for ErrorKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ErrorKind

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorKind

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> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Checks if this value is equivalent to the given key. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V