pub enum Error<E> {
FloatingPointUnsupported,
TooManyVariants {
enum_name: &'static str,
variant_name: &'static str,
variant_index: u32,
},
LengthNeeded,
TypeMustBeKnown,
ExpectedBoolean {
found: u8,
},
InvalidCharacter {
found: u32,
},
CollectionTooLargeToSerialize {
len: usize,
},
CollectionTooLargeToDeserialize,
InvalidUnicode(Utf8Error),
InvalidOption {
found_discriminant: u8,
},
Io(E),
Other(OtherError),
}
Expand description
Serialization errors
Variants§
FloatingPointUnsupported
SCALE does not specify how to serialize floating point values
TooManyVariants
SCALE limits enums to 255 variants
LengthNeeded
SCALE requires knowing the length of collections
TypeMustBeKnown
SCALE requires knowing the type of the data being deserialized
ExpectedBoolean
A boolean value (0 or 1) was expected but another byte was found
InvalidCharacter
Invalid character found. Characters must be UTF-32 code points.
CollectionTooLargeToSerialize
This implementation limits collections to 2^64 elements
CollectionTooLargeToDeserialize
This implementation limits collections to 2^64 elements
InvalidUnicode(Utf8Error)
Invalid Unicode was found in a string
InvalidOption
An option was expected but the discriminant is invalid
Io(E)
I/O error from the underlying reader or writer
Other(OtherError)
Other error the serializer or deserializer might encounter
Trait Implementations§
Source§impl<E: Debug + Display> Error for Error<E>
impl<E: Debug + Display> Error for Error<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<E: Debug + Display> Error for Error<E>
impl<E: Debug + Display> Error for Error<E>
Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Raised when there is general error when deserializing a type. Read more
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Raised when a
Deserialize
receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Raised when a
Deserialize
receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Raised when deserializing a sequence or map and the input data contains
too many or too few elements. Read more
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Raised when a
Deserialize
enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Raised when a
Deserialize
struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Raised when a
Deserialize
struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Raised when a
Deserialize
struct type received more than one of the
same field.Auto Trait Implementations§
impl<E> Freeze for Error<E>where
E: Freeze,
impl<E> RefUnwindSafe for Error<E>where
E: RefUnwindSafe,
impl<E> Send for Error<E>where
E: Send,
impl<E> Sync for Error<E>where
E: Sync,
impl<E> Unpin for Error<E>where
E: Unpin,
impl<E> UnwindSafe for Error<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more