Trait spacetimedb_lib::de::Error

source ·
pub trait Error: Sized {
    // Required method
    fn custom(msg: impl Display) -> Self;

    // Provided methods
    fn invalid_product_length<'de, T>(len: usize, expected: &T) -> Self
       where T: ProductVisitor<'de> { ... }
    fn missing_field<'de, T>(
        index: usize,
        field_name: Option<&str>,
        prod: &T
    ) -> Self
       where T: ProductVisitor<'de> { ... }
    fn duplicate_field<'de, T>(
        index: usize,
        field_name: Option<&str>,
        prod: &T
    ) -> Self
       where T: ProductVisitor<'de> { ... }
    fn unknown_field_name<'de, T>(field_name: &str, expected: &T) -> Self
       where T: FieldNameVisitor<'de> { ... }
    fn unknown_variant_tag<'de, T>(tag: u8, expected: &T) -> Self
       where T: SumVisitor<'de> { ... }
    fn unknown_variant_name<T>(name: &str, expected: &T) -> Self
       where T: VariantVisitor { ... }
}
Expand description

The Error trait allows Deserialize implementations to create descriptive error messages belonging to the Deserializer against which they are currently running.

Every Deserializer declares an Error type that encompasses both general-purpose deserialization errors as well as errors specific to the particular deserialization format.

Most deserializers should only need to provide the Error::custom method and inherit the default behavior for the other methods.

Required Methods§

source

fn custom(msg: impl Display) -> Self

Raised when there is general error when deserializing a type.

Provided Methods§

source

fn invalid_product_length<'de, T>(len: usize, expected: &T) -> Selfwhere T: ProductVisitor<'de>,

The product length was not as promised.

source

fn missing_field<'de, T>( index: usize, field_name: Option<&str>, prod: &T ) -> Selfwhere T: ProductVisitor<'de>,

There was a missing field at index.

source

fn duplicate_field<'de, T>( index: usize, field_name: Option<&str>, prod: &T ) -> Selfwhere T: ProductVisitor<'de>,

A field with index was specified more than once.

source

fn unknown_field_name<'de, T>(field_name: &str, expected: &T) -> Selfwhere T: FieldNameVisitor<'de>,

A field with name field_name does not exist.

source

fn unknown_variant_tag<'de, T>(tag: u8, expected: &T) -> Selfwhere T: SumVisitor<'de>,

The tag does not specify a variant of the sum type.

source

fn unknown_variant_name<T>(name: &str, expected: &T) -> Selfwhere T: VariantVisitor,

The name is not that of a variant of the sum type.

Object Safety§

This trait is not object safe.

Implementors§