pub enum Error {
Custom,
Overrun,
TooManyVariants,
NotSupported,
Truncated,
Invalid,
}
Expand description
Errors that can result from hubpack
serialization or deserialization.
Variants§
Custom
The Serialize
or Deserialize
implementation for some type produced
serde
’s Custom
error type. This is never produced by hubpack
itself, but is simply passed through from existing types.
Overrun
Serializing a value failed because there were not enough bytes available in the destination buffer.
TooManyVariants
Serializing a value failed because it is an enum type with more than 256 variants, which we don’t support.
NotSupported
Serializing a value failed because it is a type we don’t support, such
as a sequence, map, or char
.
Truncated
Deserializing a value failed because its serialized representation ended unexpectedly.
Invalid
Deserializing a value failed because an encoded value was out of range
for its type, such as a bool
with a value of 39
.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn custom<T: Display>(_msg: T) -> Self
fn custom<T: Display>(_msg: T) -> Self
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
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
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
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
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
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
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
Deserialize
struct type received more than one of the
same field.