Skip to main content

ErrorKind

Enum ErrorKind 

Source
#[non_exhaustive]
pub enum ErrorKind<'a> {
Show 30 variants Custom(&'a str), UnexpectedEof, FileTooLarge, InvalidCharInString(char), InvalidEscape(char), InvalidHexEscape(char), InvalidEscapeValue(u32), Unexpected(char), UnterminatedString(char), InvalidInteger(&'static str), InvalidFloat(&'static str), InvalidDateTime(&'static str), OutOfRange { ty: &'static &'static str, range: &'static &'static str, }, Wanted { expected: &'static &'static str, found: &'static &'static str, }, DuplicateTable { name: Span, first: Span, }, DuplicateKey { first: Span, }, RedefineAsArray { first: Span, }, MultilineStringKey, DottedKeyInvalidType { first: Span, }, UnexpectedKey { tag: u32, }, UnquotedString, MissingField(&'static str), DuplicateField { field: &'static str, first: Span, }, Deprecated { tag: u32, old: &'static &'static str, new: &'static &'static str, }, UnexpectedValue { expected: &'static [&'static str], }, UnexpectedVariant { expected: &'static [&'static str], }, MissingArrayComma, UnclosedArray, MissingInlineTableComma, UnclosedInlineTable,
}
Expand description

The specific kind of error.

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

Custom(&'a str)

A custom error message

§

UnexpectedEof

EOF was reached when looking for a value.

§

FileTooLarge

The input file is larger than the maximum supported size of 512 MiB.

§

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(char)

An unterminated string was found where EOF or a newline was reached before the closing delimiter.

The char is the expected closing delimiter (" or ').

§

InvalidInteger(&'static str)

An integer literal failed to parse, with an optional reason.

§

InvalidFloat(&'static str)

A float literal failed to parse, with an optional reason.

§

InvalidDateTime(&'static str)

A datetime literal failed to parse, with an optional reason.

§

OutOfRange

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

Fields

§ty: &'static &'static str

The target type name (e.g. "u8")

§range: &'static &'static str

The accepted range as a display string (e.g. "0..=255"), or empty

§

Wanted

Wanted one sort of token, but found another.

Fields

§expected: &'static &'static str

Expected token type.

§found: &'static &'static str

Actually found token type.

§

DuplicateTable

A duplicate table definition was found.

Fields

§name: Span

The span of the table name (for extracting the name from source)

§first: Span

The span where the table was first defined

§

DuplicateKey

Duplicate key in table.

Fields

§first: Span

The span where the first key is located

§

RedefineAsArray

A previously defined table was redefined as an array.

Fields

§first: Span

The span where the table was first defined

§

MultilineStringKey

Multiline strings are not allowed for key.

§

DottedKeyInvalidType

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

Fields

§first: Span

The span where the non-table value was defined

§

UnexpectedKey

An unexpected key was encountered.

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

Fields

§tag: u32

Developer provided association tag useful for programmatic filtering or adding additional messages or notes to diagnostics. Defaults to 0.

§

UnquotedString

Unquoted string was found when quoted one was expected.

§

MissingField(&'static str)

A required field is missing from a table

§

DuplicateField

A field was set more than once (e.g. via primary key and alias)

Fields

§field: &'static str

The canonical struct field name

§first: Span

The span where the key was first defined

§

Deprecated

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

Fields

§tag: u32

Developer provided association tag useful for programmatic filtering or adding additional messages or notes to diagnostics such as version info. Defaults to 0.

§old: &'static &'static str

The deprecated key name

§new: &'static &'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

§

UnexpectedVariant

A string did not match any known variant

Fields

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

The list of variant names that would have been accepted

§

MissingArrayComma

A comma is missing between elements in an array.

§

UnclosedArray

An array was not closed before EOF.

§

MissingInlineTableComma

A comma is missing between entries in an inline table.

§

UnclosedInlineTable

An inline table was not closed before EOF or a newline.

Implementations§

Source§

impl<'a> ErrorKind<'a>

Source

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

Trait Implementations§

Source§

impl<'a> Clone for ErrorKind<'a>

Source§

fn clone(&self) -> ErrorKind<'a>

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<'a> Debug for ErrorKind<'a>

Source§

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

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

impl<'a> Copy for ErrorKind<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ErrorKind<'a>

§

impl<'a> RefUnwindSafe for ErrorKind<'a>

§

impl<'a> Send for ErrorKind<'a>

§

impl<'a> Sync for ErrorKind<'a>

§

impl<'a> Unpin for ErrorKind<'a>

§

impl<'a> UnsafeUnpin for ErrorKind<'a>

§

impl<'a> UnwindSafe for ErrorKind<'a>

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.