pub enum Error {
Show 13 variants
InvalidMajorType(u8, u8),
InvalidAdditionalInfo(u8),
UnexpectedEof,
NonCanonical,
InvalidUtf8,
TrailingBytes,
UnexpectedItemCount(u64, usize),
UnsupportedType(u8),
IntegerOverflow(bool, u64, u64),
DuplicateMapKey(i64),
InvalidMapKeyOrder(i64, i64),
MaxDepthExceeded(usize),
DecodeFailed(String),
}cbor only.Expand description
Failures of encoding and decoding CBOR data.
Variants§
InvalidMajorType(u8, u8)
The next item has the first major type where the second was expected.
InvalidAdditionalInfo(u8)
The additional info bits name an encoding outside the supported subset, indefinite lengths or reserved values.
UnexpectedEof
The data ended inside an item.
NonCanonical
An integer or length is not in its shortest form.
InvalidUtf8
A text string is not valid UTF-8. Raised by Decoder::decode_text and
verify.
TrailingBytes
UnexpectedItemCount(u64, usize)
An array or byte string has the first length where the target type needs the second.
UnsupportedType(u8)
The major type is outside the supported subset, tags, floats or simple
values other than booleans and null. Raised by verify and when a
Raw item is skipped over.
IntegerOverflow(bool, u64, u64)
An integer does not fit the target type. The flag marks a negative
value, followed by the wire value and the largest one allowed. Raised
by Decoder::decode_int.
DuplicateMapKey(i64)
A map carries the key twice, on decoding or when
MapEncodeBuffer::finish_to assembles one.
InvalidMapKeyOrder(i64, i64)
Map keys are out of deterministic order. The first key was read after the second but sorts before it.
MaxDepthExceeded(usize)
DecodeFailed(String)
A type’s own validation rejected the decoded value, a key of the wrong size, an unknown map key or a missing required one. The message names the problem.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()