Skip to main content

TomlErrorKind

Enum TomlErrorKind 

Source
pub enum TomlErrorKind {
    Parse(String),
    UnexpectedType {
        expected: &'static str,
        got: &'static str,
    },
    UnexpectedEof {
        expected: &'static str,
    },
    UnknownField {
        field: String,
        expected: Vec<&'static str>,
        suggestion: Option<&'static str>,
    },
    MissingField {
        field: &'static str,
        table_start: Option<Span>,
        table_end: Option<Span>,
    },
    InvalidValue {
        message: String,
    },
    Reflect(ReflectError),
    NumberOutOfRange {
        value: String,
        target_type: &'static str,
    },
    DuplicateKey {
        key: String,
    },
    InvalidUtf8(Utf8Error),
    Solver(String),
    Serialize(String),
}
Expand description

Specific error kinds for TOML operations

Variants§

§

Parse(String)

Parse error from toml_parser

§

UnexpectedType

Unexpected value type

Fields

§expected: &'static str

What type was expected

§got: &'static str

What type was found

§

UnexpectedEof

Unexpected end of input

Fields

§expected: &'static str

What was expected before EOF

§

UnknownField

Unknown field in table

Fields

§field: String

The unknown field name

§expected: Vec<&'static str>

List of valid field names

§suggestion: Option<&'static str>

Suggested field name (if similar to an expected field)

§

MissingField

Missing required field

Fields

§field: &'static str

The name of the missing field

§table_start: Option<Span>

Span of the table start (opening header)

§table_end: Option<Span>

Span of the table end

§

InvalidValue

Invalid value for type

Fields

§message: String

Description of why the value is invalid

§

Reflect(ReflectError)

Reflection error from facet-reflect

§

NumberOutOfRange

Number out of range

Fields

§value: String

The numeric value that was out of range

§target_type: &'static str

The target type that couldn’t hold the value

§

DuplicateKey

Duplicate key in table

Fields

§key: String

The key that appeared more than once

§

InvalidUtf8(Utf8Error)

Invalid UTF-8 in string

§

Solver(String)

Solver error (for flattened types)

§

Serialize(String)

Serialization error

Implementations§

Source§

impl TomlErrorKind

Source

pub const fn code(&self) -> &'static str

Get an error code for this kind of error.

Source

pub fn label(&self) -> String

Get a label describing where/what the error points to.

Trait Implementations§

Source§

impl Clone for TomlErrorKind

Source§

fn clone(&self) -> TomlErrorKind

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 TomlErrorKind

Source§

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

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

impl Display for TomlErrorKind

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§

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

Source§

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

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.