Enum cbored::ReaderError
source · [−]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
Wrong expected type, the user is asking for a specific expected type, but got some other type.
WrongExpectedTypes
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
Wrong expected tags, the user is asking for a specific expected tag, but got some other type.
WrongExpectedTags
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
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
Expected termination, but still some trailing data available
Trait Implementations
sourceimpl Clone for ReaderError
impl Clone for ReaderError
sourcefn clone(&self) -> ReaderError
fn clone(&self) -> ReaderError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ReaderError
impl Debug for ReaderError
sourceimpl From<CborDataMissing> for ReaderError
impl From<CborDataMissing> for ReaderError
sourcefn from(e: CborDataMissing) -> Self
fn from(e: CborDataMissing) -> Self
Converts to this type from the input type.
sourceimpl From<ReaderError> for DecodeError
impl From<ReaderError> for DecodeError
sourcefn from(r: ReaderError) -> DecodeError
fn from(r: ReaderError) -> DecodeError
Converts to this type from the input type.
sourceimpl From<StateError> for ReaderError
impl From<StateError> for ReaderError
sourcefn from(e: StateError) -> Self
fn from(e: StateError) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for ReaderError
impl Send for ReaderError
impl Sync for ReaderError
impl Unpin for ReaderError
impl UnwindSafe for ReaderError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more