pub enum ReaderError {
Show 15 variants LeadError(LeadError), DataMissing(CborDataMissing), StateError(StateError), WrongExpectedType { expected: Type, got: Type, }, WrongExpectedTypes { expected: &'static [Type], got: Type, }, WrongExpectedTag { expected: u64, got: u64, }, WrongExpectedTags { expected: &'static [u64], got: u64, }, WrongExpectedLength { expected: usize, got: usize, }, UnexpectedBreakType, TextUTF8Error(Utf8Error), TextChunksInTextChunks, BytesChunksInBytesChunks, WrongExpectedTypeInText { got: Type, }, WrongExpectedTypeInBytes { got: Type, }, NotTerminated { at: usize, remaining_bytes: usize, next_byte: u8, },
}
Expand description

Possible error when reading CBOR from a data stream

Variants

LeadError(LeadError)

The element header was invalid

DataMissing(CborDataMissing)

Trying to read more data than was available in the buffer. This can be used to fill more data in the buffer, as it return the number of byte missing

StateError(StateError)

When trying to get element, the overall CBOR state machine represent an invalid transition, for example a break in a non indefinite structure

WrongExpectedType

Fields

expected: Type
got: Type

Wrong expected type, the user is asking for a specific expected type, but got some other type.

WrongExpectedTypes

Fields

expected: &'static [Type]
got: Type

Wrong expected types, the user is asking for a specific set of expected types, but got some other type. This is similar to WrongExpectedType but works with a list of multiple types

WrongExpectedTag

Fields

expected: u64
got: u64

Wrong expected tags, the user is asking for a specific expected tag, but got some other type.

WrongExpectedTags

Fields

expected: &'static [u64]
got: u64

Wrong expected tags, the user is asking for a specific set of expected tags, but got some other tag. This is similar to WrongExpectedTag but works with a list of multiple tags

WrongExpectedLength

Fields

expected: usize
got: usize

Length expected is not met

UnexpectedBreakType

Unexpected break type

TextUTF8Error(Utf8Error)

Text is not a valid UTF8 string

TextChunksInTextChunks

Indefinite text into another indefinite text

BytesChunksInBytesChunks

Indefinite bytes into another indefinite bytes

WrongExpectedTypeInText

Fields

got: Type

Unexpected type received in an indefinite Text where only definite Text chunk are allowed

WrongExpectedTypeInBytes

Fields

got: Type

Unexpected type received in an indefinite Bytes where only definite Bytes chunk are allowed

NotTerminated

Fields

at: usize
remaining_bytes: usize
next_byte: u8

Expected termination, but still some trailing data available

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.