Enum serde::de::Unexpected[][src]

pub enum Unexpected<'a> {
Show 18 variants Bool(bool), Unsigned(u64), Signed(i64), Float(f64), Char(char), Str(&'a str), Bytes(&'a [u8]), Unit, Option, NewtypeStruct, Seq, Map, Enum, UnitVariant, NewtypeVariant, TupleVariant, StructVariant, Other(&'a str),
}
Expand description

Unexpected represents an unexpected invocation of any one of the Visitor trait methods.

This is used as an argument to the invalid_type, invalid_value, and invalid_length methods of the Error trait to build error messages.

fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
where
    E: de::Error,
{
    Err(de::Error::invalid_type(Unexpected::Bool(v), &self))
}

Variants

Bool

The input contained a boolean value that was not expected.

Tuple Fields of Bool

0: bool
Unsigned

The input contained an unsigned integer u8, u16, u32 or u64 that was not expected.

Tuple Fields of Unsigned

0: u64
Signed

The input contained a signed integer i8, i16, i32 or i64 that was not expected.

Tuple Fields of Signed

0: i64
Float

The input contained a floating point f32 or f64 that was not expected.

Tuple Fields of Float

0: f64
Char

The input contained a char that was not expected.

Tuple Fields of Char

0: char
Str

The input contained a &str or String that was not expected.

Tuple Fields of Str

0: &'a str
Bytes

The input contained a &[u8] or Vec<u8> that was not expected.

Tuple Fields of Bytes

0: &'a [u8]
Unit

The input contained a unit () that was not expected.

Option

The input contained an Option<T> that was not expected.

NewtypeStruct

The input contained a newtype struct that was not expected.

Seq

The input contained a sequence that was not expected.

Map

The input contained a map that was not expected.

Enum

The input contained an enum that was not expected.

UnitVariant

The input contained a unit variant that was not expected.

NewtypeVariant

The input contained a newtype variant that was not expected.

TupleVariant

The input contained a tuple variant that was not expected.

StructVariant

The input contained a struct variant that was not expected.

Other

A message stating what uncategorized thing the input contained that was not expected.

The message should be a noun or noun phrase, not capitalized and without a period. An example message is “unoriginal superhero”.

Tuple Fields of Other

0: &'a str

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.