#[non_exhaustive]pub enum Reason {
Decoder(DecoderError),
Encoder(EncoderError),
TypeMismatch {
expected: String,
found: String,
},
OutOfRange {
detail: String,
},
UnknownEnumerator {
detail: String,
},
Alternative {
detail: String,
},
Field {
detail: String,
},
InvalidValue {
detail: String,
},
}Expand description
Why a value could not be encoded or decoded.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Decoder(DecoderError)
The octets are not a complete, well-formed encoding: truncated input, an impossible element count, octets left after the value, an alternative that does not fill its announced length.
Encoder(EncoderError)
The value exceeds a limit of the encoding itself: element count or alternative length.
TypeMismatch
The value does not have the shape the data type needs (encoding).
OutOfRange
A number, a character or an element count is outside the range of the data type (encoding).
UnknownEnumerator
A name or a number is not an enumerator of the enumerated data type (encoding).
Alternative
The discriminant of a variant record selects no alternative, or the value does not match the alternative it selects.
Field
A record value lacks a field, repeats one or has one the data type does not define (encoding).
InvalidValue
The octets do not form a legal value of the data type (decoding).
Trait Implementations§
impl Eq for Reason
Source§impl Error for Reason
impl Error for Reason
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()