#[non_exhaustive]pub enum Error {
Show 16 variants
UnexpectedEnd {
additional: usize,
},
InvalidData {
message: &'static str,
},
InvalidIntegerType {
expected: IntegerType,
found: IntegerType,
},
InvalidBooleanValue(u8),
InvalidCharEncoding([u8; 4]),
Utf8 {
inner: Utf8Error,
},
LimitExceeded {
limit: u64,
found: u64,
},
Io {
kind: ErrorKind,
message: String,
},
Custom {
message: &'static str,
},
OwnedCustom {
message: String,
},
OutsideUsizeRange(u64),
NonZeroTypeIsZero {
non_zero_type: IntegerType,
},
UnexpectedVariant {
found: u32,
type_name: &'static str,
},
InvalidDuration {
secs: u64,
nanos: u32,
},
InvalidSystemTime {
duration: Duration,
},
ChecksumMismatch {
expected: u32,
found: u32,
},
}Expand description
Error type for encoding and decoding operations
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEnd
Unexpected end of input during decoding
InvalidData
Invalid data encountered during decoding
InvalidIntegerType
Invalid integer type during varint decoding
InvalidBooleanValue(u8)
Invalid boolean value
InvalidCharEncoding([u8; 4])
Invalid character encoding
Utf8
alloc only.UTF-8 decoding error
LimitExceeded
Configuration limit exceeded
Io
std only.IO error during encoding or decoding
Custom
Custom error message (static string)
OwnedCustom
alloc only.Custom error message (owned string, from serde or dynamic sources)
OutsideUsizeRange(u64)
Value outside usize range (for platforms with smaller usize)
NonZeroTypeIsZero
NonZero type decoded as zero
Fields
non_zero_type: IntegerTypeThe NonZero type that was zero
UnexpectedVariant
Invalid enum variant
InvalidDuration
std only.Invalid duration (nanos >= 1_000_000_000)
Reserved: this variant is not yet constructed by the current decoding
paths (which report out-of-range Duration values via
Error::InvalidData instead). It is kept public and documented so
that future wire-compatibility work can switch those call sites to a
structured error without a breaking enum change.
InvalidSystemTime
std only.Invalid SystemTime (before UNIX_EPOCH)
Reserved: this variant is not yet constructed by the current decoding
paths (which report out-of-range SystemTime values via
Error::InvalidData instead). It is kept public and documented so
that future wire-compatibility work can switch those call sites to a
structured error without a breaking enum change.
ChecksumMismatch
checksum only.Checksum mismatch during data verification
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
Available on crate feature std only.
impl Error for Error
std only.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()