#[non_exhaustive]pub enum Error {
Show 27 variants
Truncated {
have: usize,
need: usize,
},
BadSom(u8),
BadLength {
declared: usize,
actual: usize,
},
BadControlByte(u8),
BadCrc {
got: u16,
want: u16,
},
BadChecksum {
got: u8,
want: u8,
},
BadAddress(u8),
BadSqn(u8),
BadSecurityBlock(u8),
BadSecurityBlockLength(u8),
BadMac,
ShortMac,
UnknownCommand(u8),
UnknownReply(u8),
MalformedPayload {
code: u8,
reason: &'static str,
},
PayloadLength {
code: u8,
expected: usize,
got: usize,
},
PayloadTooShort {
code: u8,
min: usize,
got: usize,
},
PayloadNotMultiple {
code: u8,
block: usize,
got: usize,
},
Multipart(MultipartError),
SecureSession(SecureSessionError),
Io(&'static str),
Timeout,
Offline,
AddrMismatch {
sent: u8,
got: u8,
},
SqnMismatch {
expected: u8,
got: u8,
},
Nak {
code: u8,
},
BufferOverflow {
need: usize,
have: usize,
},
}Expand description
Crate-wide error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated
Buffer too small to hold a syntactically valid packet header.
BadSom(u8)
SOM mismatch — packet did not start with 0x53.
BadLength
LEN field disagrees with the actual buffer length.
BadControlByte(u8)
Reserved bits in the crate::ControlByte are non-zero, or the byte is
otherwise malformed.
BadCrc
CRC verification failed.
BadChecksum
Checksum verification failed.
BadAddress(u8)
Address field is reserved or invalid.
BadSqn(u8)
Sequence number is not in 0..=3.
BadSecurityBlock(u8)
Security block type is unknown.
BadSecurityBlockLength(u8)
Length of the security block is wrong for its type.
BadMac
MAC verification failed (constant-time compare).
ShortMac
MAC is too short (must be at least 4 bytes on the wire).
UnknownCommand(u8)
Command code is not recognized.
UnknownReply(u8)
Reply code is not recognized.
MalformedPayload
Payload bytes do not match the expected layout for this command/reply.
PayloadLength
Payload length differs from the fixed length the message defines.
Fields
PayloadTooShort
Payload is shorter than the minimum needed to parse the header.
Fields
PayloadNotMultiple
Record-array payload is not a positive multiple of the record size.
Fields
Multipart(MultipartError)
Multi-part receiver detected an invariant violation.
SecureSession(SecureSessionError)
Secure-channel state machine rejected an event.
Io(&'static str)
Transport-level I/O.
Timeout
Reply did not arrive within the configured budget.
Offline
PD declared off-line.
AddrMismatch
Address mismatch between expected PD and reply ADDR.
SqnMismatch
Reply carried a sequence number we did not request. Per spec §5.7 / Table 2 the PD must echo the ACU’s SQN; a mismatch typically means a stale reply from a desynchronised PD.
Nak
PD answered with crate::reply::Nak.
BufferOverflow
Output buffer was too small.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()