Skip to main content

decode_pdu_ref

Function decode_pdu_ref 

Source
pub fn decode_pdu_ref(pdu: &[u8]) -> Result<PduRef<'_>, DecodeError>
Expand description

Split a raw PDU into function code + data without further dispatching.

The input slice starts at the function code byte (after MBAP header or RTU address).

ยงErrors

Returns DecodeError::PduTooLarge if pdu exceeds the Modbus 253-byte PDU ceiling. Returns DecodeError::Truncated if the slice is empty.