pub enum DecodeError {
Show 25 variants
Io(Error),
UnexpectedEof,
InvalidCbor {
reason: String,
},
NonCanonicalEncoding {
major_type: u8,
additional_info: u8,
value: u64,
},
UnsupportedTag {
tag: u64,
},
MapKeyNotString,
InvalidCid {
reason: String,
},
InvalidCidContent,
InvalidFloat,
UnsupportedSimpleValue {
value: u8,
},
IndefiniteLengthNotSupported,
TypeMismatch {
expected: &'static str,
found: String,
},
MaxDepthExceeded {
depth: usize,
max: usize,
},
AllocationExceeded {
size: usize,
max: usize,
},
InvalidUtf8(FromUtf8Error),
MapKeysNotSorted,
ReservedAdditionalInfo {
value: u8,
},
Deserialization(String),
TrailingData,
NonCanonicalFloat,
DuplicateMapKey,
FloatsNotAllowed,
IntegerOutOfRange {
value: String,
},
ArrayTooLarge {
count: usize,
max: usize,
},
MapTooLarge {
count: usize,
max: usize,
},
}Expand description
Errors that can occur during DAG-CBOR decoding
Variants§
Io(Error)
I/O error during reading
UnexpectedEof
Unexpected end of input
InvalidCbor
Invalid CBOR major type
NonCanonicalEncoding
Non-canonical encoding in strict mode
Fields
UnsupportedTag
Unsupported CBOR tag (only tag 42 allowed)
MapKeyNotString
Map key is not a string (DAG-CBOR requirement)
InvalidCid
Invalid CID encoding
InvalidCidContent
CID tag not followed by byte string
InvalidFloat
Invalid float value (NaN or Infinity)
UnsupportedSimpleValue
Invalid simple value (only false, true, null allowed)
IndefiniteLengthNotSupported
Indefinite length not supported
TypeMismatch
Type mismatch during deserialization
MaxDepthExceeded
Maximum nesting depth exceeded
AllocationExceeded
Allocation limit exceeded
InvalidUtf8(FromUtf8Error)
Invalid UTF-8 in text string
MapKeysNotSorted
Non-canonical map key ordering in strict mode
ReservedAdditionalInfo
Reserved additional info value (28-30)
Deserialization(String)
Deserialization error from serde
TrailingData
Trailing data after top-level object
NonCanonicalFloat
Non-canonical float encoding (not 64-bit)
DuplicateMapKey
Duplicate map key detected
FloatsNotAllowed
Float values not allowed (no_floats config)
IntegerOutOfRange
Integer out of i64 range (int64_range_only config)
ArrayTooLarge
Array exceeds maximum element count
MapTooLarge
Map exceeds maximum entry count
Trait Implementations§
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl Error for DecodeError
impl Error for DecodeError
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.