Skip to main content

SerdeError

Enum SerdeError 

Source
#[non_exhaustive]
pub enum SerdeError { InvalidVariant(&'static str), InvalidVariantMatcherSyntax(String), InvalidTag(String), MissingIdentifier, Other(String), UnexpectedTag { expected: TtlvTag, actual: TtlvTag, }, UnexpectedType { expected: TtlvType, actual: TtlvType, }, UnsupportedRustType(&'static str), }
Expand description

Errors while (de)serializing from/to Rust data structures.

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

InvalidVariant(&'static str)

An enum variant name is neither a hexadecimal string value nor valid matcher syntax.

Valid enum variant names must be set using #[serde(rename = "...")] and must either be a hexadecimal string value such as "0x01ABEF" or must be valid variant matcher syntax such as "if 0xABCDEF==0x123456". See the crate level documentation for more details.

§

InvalidVariantMatcherSyntax(String)

An enum variant name is not valid matcher syntax. See the crate level documentation for more details.

§

InvalidTag(String)

The #[serde(rename = "...")] name assigned to a Rust data type is not a valid TTLV six character hexadecimal value such as 0x12ABEF.

§

MissingIdentifier

None of the #[serde(rename = "...")] named fields in the Rust struct being deserialized into matches the TTLV tag value being deserialized.

§

Other(String)

A problem occurred during (de)serialization that is not described by one of the other SerdeError enum variants. This primarily occurs when Serde Derive generated code or Serde library code fails internally and does not provide a more specific dedicated error type for the situation at hand.

§

UnexpectedTag

The TTLV tag value being deserialized does not match the #[serde(rename = "...")] name assigned to any of the candidate Rust struct members currently being deserialized into. This can happen when the field is not always present in the data stream and so should be wrapped in Option<...> in the Rust data structure, or when the order of the fields in the Rust structure does not match the order of the fields in the TTLV Structure.

Fields

§expected: TtlvTag
§actual: TtlvTag
§

UnexpectedType

The TTLV type of the value being deserialized does not match the type of the Rust data structure field being deserialized into.

Fields

§expected: TtlvType
§actual: TtlvType
§

UnsupportedRustType(&'static str)

The TTLV type of the value being deserialized is not supported yet by the deserializer.

Trait Implementations§

Source§

impl Debug for SerdeError

Source§

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

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

impl From<SerdeError> for ErrorKind

Source§

fn from(err: SerdeError) -> Self

Converts to this type from the input type.

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