#[non_exhaustive]pub enum Error {
Show 20 variants
UnexpectedEnd,
InvalidTl(u8),
UnexpectedType {
expected: Kind,
found: Kind,
},
ListLength {
expected: usize,
found: usize,
},
InvalidLength,
ValueOutOfRange,
DepthLimit,
MissingEndOfMessage,
ObisLength(usize),
UnknownChoice {
what: &'static str,
choice: u64,
},
MessageCrc {
computed: u16,
found: u16,
},
FrameCrc {
computed: u16,
found: u16,
},
InvalidPadding,
InvalidEscape([u8; 4]),
UnexpectedStart,
BufferFull,
OutputTooSmall,
NoReadings,
ObisSyntax,
InvalidFile,
}Expand description
Everything that can go wrong between the meter’s bytes and a typed reading.
Every variant is a property of the input, never of this crate’s state: a decoder that returns an error can be fed the next byte.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEnd
The input ended in the middle of a value.
InvalidTl(u8)
A type-length field is malformed (an unknown type, a continuation byte with type bits set, or a length shorter than its own TL bytes).
UnexpectedType
A value of one type was found where another was required.
ListLength
A list has a different number of elements than the grammar requires.
InvalidLength
A length is out of range for its type (an integer of 0 or more than 8 bytes, a boolean that is not 1 byte, a TL field of more than 4 bytes).
ValueOutOfRange
An unsigned value does not fit the field it was read into.
DepthLimit
Lists are nested deeper than the decoder allows.
MissingEndOfMessage
The end-of-message byte (0x00) is missing after the message CRC.
ObisLength(usize)
An object name is not the six bytes of an OBIS code.
UnknownChoice
A choice (SML_Time, SML_Value) uses a tag this crate does not know.
MessageCrc
The message CRC does not match its bytes.
FrameCrc
The transport CRC does not match the frame.
InvalidPadding
The end sequence announces more padding than the frame has, or a padding byte is not zero.
InvalidEscape([u8; 4])
An escape sequence is followed by a command this crate does not know.
UnexpectedStart
A new start sequence arrived before the current frame ended. The decoder has already begun the new frame; the old one is lost.
BufferFull
A frame does not fit the buffer the caller gave the decoder.
OutputTooSmall
The output buffer is too small for what is being written.
NoReadings
The frame holds no GetListResponse, so there are no readings in it.
ObisSyntax
Text is not an OBIS code (A-B:C.D.E*F, A-B:C.D.E or C.D.E).
InvalidFile
An SmlFile does not open first and close last, or has more
than 256 messages.
Trait Implementations§
impl Copy for Error
impl Eq for Error
Source§impl Error for Error
The core error trait: available without std (stable since Rust 1.81).
impl Error for Error
The core error trait: available without std (stable since Rust 1.81).
1.30.0 · 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()