#[non_exhaustive]pub enum DecodingError {
UnexpectedEnd {
extra_len: usize,
},
UnexpectedVariant {
type_name: &'static str,
found_byte: u8,
},
Str(Utf8Error),
IntegerOverflow,
DateTime,
}Expand description
Errors that can be occurred by decoding a type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UnexpectedEnd
The source reached its end but more bytes were expected.
UnexpectedVariant
Invalid variant was found. This error is generally for enums.
Fields
Str(Utf8Error)
Which can be occurred when attempting to decode bytes as a str, it is
essentially an UTF-8 error.
IntegerOverflow
The encoded varint is outside of the range of the target integral type.
This may happen if an usize was encoded on 64-bit architecture and then decoded on 32-bit architecture (from large type to small type).
DateTime
Which can be occurred on out-of-range number of seconds and/or invalid nanosecond.
Trait Implementations§
Source§impl Clone for DecodingError
impl Clone for DecodingError
Source§fn clone(&self) -> DecodingError
fn clone(&self) -> DecodingError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DecodingError
impl Debug for DecodingError
Source§impl Display for DecodingError
impl Display for DecodingError
Source§impl Error for DecodingError
impl Error for DecodingError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for DecodingError
impl RefUnwindSafe for DecodingError
impl Send for DecodingError
impl Sync for DecodingError
impl Unpin for DecodingError
impl UnwindSafe for DecodingError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more