pub enum DecodeError {
Show 20 variants
Truncated {
expected: usize,
actual: usize,
},
LengthMismatch {
expected: usize,
actual: usize,
},
PduTooLarge {
length: usize,
maximum: usize,
},
UnknownFunctionCode(u8),
ByteCountMismatch {
declared: usize,
actual: usize,
},
ByteCountOutOfRange {
count: usize,
minimum: usize,
maximum: usize,
},
QuantityOutOfRange {
quantity: u16,
},
InvalidCoilValue(u16),
InvalidReferenceType(u8),
InvalidFileRecordLength {
length: usize,
},
FileRecordOutOfRange {
file_number: u16,
record_number: u16,
record_length: u16,
},
UnknownMeiType(u8),
UnknownExceptionCode(u8),
UnknownDiagnosticSubFunction(u16),
InvalidDiagnosticDataLength {
length: usize,
},
InvalidDeviceIdCode(u8),
InvalidDeviceIdConformityLevel(u8),
InvalidDeviceIdMoreFollows(u8),
InvalidDeviceIdNextObjectId(u8),
InvalidDeviceIdObjectCount(u8),
}Expand description
Errors that can occur when decoding a Modbus PDU.
Variants§
Truncated
PDU is shorter than the minimum for the function code.
LengthMismatch
PDU has extra bytes for a fixed-length function code.
PduTooLarge
PDU exceeds the Modbus maximum of 253 bytes.
UnknownFunctionCode(u8)
Function code byte is not recognized.
ByteCountMismatch
Byte count field does not match actual remaining data length.
ByteCountOutOfRange
Byte count field is outside the allowed range for this function code.
Fields
QuantityOutOfRange
Quantity value is outside the allowed range for this function code.
InvalidCoilValue(u16)
Coil value is neither 0xFF00 nor 0x0000.
InvalidReferenceType(u8)
File sub-request reference type is not 6.
InvalidFileRecordLength
Packed file-record data cannot be split into valid sub-record groups.
FileRecordOutOfRange
File-record address fields are outside the Modbus file-record model.
Fields
UnknownMeiType(u8)
MEI type byte is not recognized.
UnknownExceptionCode(u8)
Exception code byte is not recognized.
UnknownDiagnosticSubFunction(u16)
Diagnostic sub-function code is not recognized.
InvalidDiagnosticDataLength
Diagnostics data is not an even number of bytes.
InvalidDeviceIdCode(u8)
Device ID code byte is not recognized (FC 0x2B / MEI 0x0E).
InvalidDeviceIdConformityLevel(u8)
Device ID conformity level byte is not recognized (FC 0x2B / MEI 0x0E).
InvalidDeviceIdMoreFollows(u8)
Device ID More Follows byte is neither 0x00 nor 0xFF.
InvalidDeviceIdNextObjectId(u8)
Device ID Next Object ID must be zero when More Follows is 0x00.
InvalidDeviceIdObjectCount(u8)
Individual Device ID access must return exactly one object.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DecodeError
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
Available on crate feature std only.
impl Error for DecodeError
std only.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()
Source§impl PartialEq for DecodeError
impl PartialEq for DecodeError
Source§fn eq(&self, other: &DecodeError) -> bool
fn eq(&self, other: &DecodeError) -> bool
self and other values to be equal, and is used by ==.