Enum toml_span::ErrorKind

source ·
pub enum ErrorKind {
Show 21 variants UnexpectedEof, InvalidCharInString(char), InvalidEscape(char), InvalidHexEscape(char), InvalidEscapeValue(u32), Unexpected(char), UnterminatedString, InvalidNumber, OutOfRange(&'static str), Wanted { expected: &'static str, found: &'static str, }, DuplicateTable { name: String, first: Span, }, DuplicateKey { key: String, first: Span, }, RedefineAsArray, MultilineStringKey, Custom(Cow<'static, str>), DottedKeyInvalidType { first: Span, }, UnexpectedKeys { keys: Vec<(String, Span)>, expected: Vec<String>, }, UnquotedString, MissingField(&'static str), Deprecated { old: &'static str, new: &'static str, }, UnexpectedValue { expected: &'static [&'static str], },
}
Expand description

Errors that can occur when deserializing a type.

Variants§

§

UnexpectedEof

EOF was reached when looking for a value.

§

InvalidCharInString(char)

An invalid character not allowed in a string was found.

§

InvalidEscape(char)

An invalid character was found as an escape.

§

InvalidHexEscape(char)

An invalid character was found in a hex escape.

§

InvalidEscapeValue(u32)

An invalid escape value was specified in a hex escape in a string.

Valid values are in the plane of unicode codepoints.

§

Unexpected(char)

An unexpected character was encountered, typically when looking for a value.

§

UnterminatedString

An unterminated string was found where EOF was found before the ending EOF mark.

§

InvalidNumber

A number failed to parse.

§

OutOfRange(&'static str)

The number in the toml file cannot be losslessly converted to the specified number type

§

Wanted

Wanted one sort of token, but found another.

Fields

§expected: &'static str

Expected token type.

§found: &'static str

Actually found token type.

§

DuplicateTable

A duplicate table definition was found.

Fields

§name: String

The name of the duplicate table

§first: Span

The span where the table was first defined

§

DuplicateKey

Duplicate key in table.

Fields

§key: String

The duplicate key

§first: Span

The span where the first key is located

§

RedefineAsArray

A previously defined table was redefined as an array.

§

MultilineStringKey

Multiline strings are not allowed for key.

§

Custom(Cow<'static, str>)

A custom error which could be generated when deserializing a particular type.

§

DottedKeyInvalidType

Dotted key attempted to extend something that is not a table.

Fields

§first: Span

The span where the non-table value was defined

§

UnexpectedKeys

An unexpected key was encountered.

Used when deserializing a struct with a limited set of fields.

Fields

§keys: Vec<(String, Span)>

The unexpected keys.

§expected: Vec<String>

The list of keys that were expected for the table

§

UnquotedString

Unquoted string was found when quoted one was expected.

§

MissingField(&'static str)

A required field is missing from a table

§

Deprecated

A field in the table is deprecated and the new key should be used instead

Fields

§old: &'static str

The deprecated key name

§new: &'static str

The key name that should be used instead

§

UnexpectedValue

An unexpected value was encountered

Fields

§expected: &'static [&'static str]

The list of values that could have been used, eg. typically enum variants

Trait Implementations§

source§

impl Clone for ErrorKind

source§

fn clone(&self) -> ErrorKind

Returns a copy 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 Display for ErrorKind

source§

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

Formats the value using the given formatter. Read more

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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

§

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.