pub enum CborError {
Show 18 variants
TrailingBytes,
UnexpectedEnd,
InputTooLarge,
OutputTooLarge,
OffsetOverflow,
LengthTooLarge,
IntegerOutOfRange,
NonCanonicalInteger,
TruncatedArgument,
TruncatedBytes,
InvalidUtf8,
MapKeyMustBeString,
MapKeysOutOfOrder,
DisallowedSimpleValue {
value: u64,
},
DisallowedMajorType {
major: u8,
},
UnsupportedAdditionalInfo,
ContainerLengthExceedsInput,
DepthExceeded,
}Expand description
Error returned when decoding fails to conform to the DAG-CBOR profile.
Decoding fails closed: any malformed or non-canonical input yields one of these variants rather than a partial or best-effort value.
Variants§
TrailingBytes
Extra bytes remain after decoding the top-level value.
UnexpectedEnd
Input ended before the current value was fully decoded.
InputTooLarge
The encoded input exceeded the absolute DAG-CBOR boundary cap.
OutputTooLarge
Encoding would exceed the absolute DAG-CBOR boundary cap.
OffsetOverflow
Computing an offset into the input would overflow.
LengthTooLarge
A declared length is too large to represent as a platform usize.
IntegerOutOfRange
An encoded integer falls outside the supported i64 range.
NonCanonicalInteger
An integer used a longer-than-minimal (non-canonical) encoding.
TruncatedArgument
The numeric argument (length/value) bytes were truncated.
TruncatedBytes
A byte string ended before its declared length was read.
InvalidUtf8
A text string contained bytes that are not valid UTF-8.
MapKeyMustBeString
A map key was not a text string, which DAG-CBOR requires.
MapKeysOutOfOrder
Map keys were not in the canonical (sorted) order DAG-CBOR requires.
DisallowedSimpleValue
A CBOR simple value not permitted by the DAG-CBOR profile was found.
DisallowedMajorType
A CBOR major type not permitted by the DAG-CBOR profile was found.
UnsupportedAdditionalInfo
An oversized or indefinite-length additional-info value was found.
ContainerLengthExceedsInput
A declared array/map element count is larger than the remaining input could possibly satisfy. Rejected before allocating so an attacker-chosen length prefix cannot drive an out-of-memory abort.
DepthExceeded
Nesting exceeded MAX_NESTING_DEPTH.
Bounds recursion so a deeply nested input cannot overflow the stack.
Trait Implementations§
impl Copy for CborError
impl Eq for CborError
Source§impl Error for CborError
impl Error for CborError
1.30.0 · 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()