Skip to main content

ErrorKind

Enum ErrorKind 

Source
pub enum ErrorKind {
Show 16 variants MissingField { field_name: String, }, UnknownField { field_name: String, }, TypeMismatch { expected: String, found: String, }, InvalidEnumVariant { enum_name: String, variant: String, valid: Vec<String>, }, InvalidOptionValue { expected: String, found: String, }, InvalidListElement { index: usize, expected: String, found: String, }, ExpectedStruct { found: String, }, ExpectedList { found: String, }, ExpectedOption { found: String, }, ExpectedMap { found: String, }, InvalidMapKey { key: String, expected: String, found: String, }, InvalidMapValue { key: String, expected: String, found: String, }, InvalidVariantData { enum_name: String, variant: String, expected: String, found: String, }, ExpectedTuple { found: String, }, TupleLengthMismatch { expected: usize, found: usize, }, InvalidTupleElement { index: usize, expected: String, found: String, },
}
Expand description

Specific kinds of validation errors produced when RON data does not match a schema.

Variants§

§

MissingField

A required field defined in the schema is absent from the data.

Fields

§field_name: String

The name of the missing field.

§

UnknownField

The data contains a field not defined in the schema.

Fields

§field_name: String

The name of the unrecognized field.

§

TypeMismatch

A value exists but has the wrong type.

Fields

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

§

InvalidEnumVariant

A bare identifier does not match any variant of the expected enum.

Fields

§enum_name: String

The enum the identifier was validated against.

§variant: String

The identifier that was found.

§valid: Vec<String>

All valid variants for this enum.

§

InvalidOptionValue

The value inside Some(...) has the wrong type.

Fields

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

§

InvalidListElement

A list element has the wrong type.

Fields

§index: usize

The 0-based index of the offending element.

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

§

ExpectedStruct

Expected a struct (...) but found a non-struct value.

Fields

§found: String

A description of what was actually found.

§

ExpectedList

Expected a list [...] but found a non-list value.

Fields

§found: String

A description of what was actually found.

§

ExpectedOption

Expected Some(...) or None but found something else.

Fields

§found: String

A description of what was actually found.

§

ExpectedMap

Expected a map { ... } but found a non-map value.

Fields

§found: String

A description of what was actually found.

§

InvalidMapKey

A map key has the wrong type.

Fields

§key: String

A string representation of the key.

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

§

InvalidMapValue

A map value has the wrong type.

Fields

§key: String

A string representation of the key this value belongs to.

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

§

InvalidVariantData

An enum variant’s associated data does not match the expected type.

Fields

§enum_name: String

The enum name.

§variant: String

The variant name.

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

§

ExpectedTuple

Expected a tuple (...) but found a non-tuple value.

Fields

§found: String

A description of what was actually found.

§

TupleLengthMismatch

A tuple has the wrong number of elements.

Fields

§expected: usize

The number of elements expected by the schema.

§found: usize

The number of elements found in the data.

§

InvalidTupleElement

A tuple element has the wrong type.

Fields

§index: usize

The 0-based index of the offending element.

§expected: String

The type expected by the schema.

§found: String

A description of what was actually found.

Trait Implementations§

Source§

impl Clone for ErrorKind

Source§

fn clone(&self) -> ErrorKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ErrorKind

Source§

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

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

impl PartialEq for ErrorKind

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ErrorKind

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