Trait spacetimedb_sats::de::Error
source · pub trait Error: Sized {
// Required method
fn custom(msg: impl Display) -> Self;
// Provided methods
fn invalid_product_length<'de, T: ProductVisitor<'de>>(
len: usize,
expected: &T
) -> Self { ... }
fn missing_field<'de, T: ProductVisitor<'de>>(
index: usize,
field_name: Option<&str>,
prod: &T
) -> Self { ... }
fn duplicate_field<'de, T: ProductVisitor<'de>>(
index: usize,
field_name: Option<&str>,
prod: &T
) -> Self { ... }
fn unknown_field_name<'de, T: FieldNameVisitor<'de>>(
field_name: &str,
expected: &T
) -> Self { ... }
fn unknown_variant_tag<'de, T: SumVisitor<'de>>(
tag: u8,
expected: &T
) -> Self { ... }
fn unknown_variant_name<T: VariantVisitor>(name: &str, expected: &T) -> Self { ... }
}
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§
Provided Methods§
sourcefn invalid_product_length<'de, T: ProductVisitor<'de>>(
len: usize,
expected: &T
) -> Self
fn invalid_product_length<'de, T: ProductVisitor<'de>>( len: usize, expected: &T ) -> Self
The product length was not as promised.
sourcefn missing_field<'de, T: ProductVisitor<'de>>(
index: usize,
field_name: Option<&str>,
prod: &T
) -> Self
fn missing_field<'de, T: ProductVisitor<'de>>( index: usize, field_name: Option<&str>, prod: &T ) -> Self
There was a missing field at index
.
sourcefn duplicate_field<'de, T: ProductVisitor<'de>>(
index: usize,
field_name: Option<&str>,
prod: &T
) -> Self
fn duplicate_field<'de, T: ProductVisitor<'de>>( index: usize, field_name: Option<&str>, prod: &T ) -> Self
A field with index
was specified more than once.
sourcefn unknown_field_name<'de, T: FieldNameVisitor<'de>>(
field_name: &str,
expected: &T
) -> Self
fn unknown_field_name<'de, T: FieldNameVisitor<'de>>( field_name: &str, expected: &T ) -> Self
A field with name field_name
does not exist.
sourcefn unknown_variant_tag<'de, T: SumVisitor<'de>>(tag: u8, expected: &T) -> Self
fn unknown_variant_tag<'de, T: SumVisitor<'de>>(tag: u8, expected: &T) -> Self
The tag
does not specify a variant of the sum type.
sourcefn unknown_variant_name<T: VariantVisitor>(name: &str, expected: &T) -> Self
fn unknown_variant_name<T: VariantVisitor>(name: &str, expected: &T) -> Self
The name
is not that of a variant of the sum type.
Object Safety§
This trait is not object safe.