pub fn read_optional_array<const N: usize>(
buf: &[u8],
) -> (Option<[u8; N]>, &[u8])Expand description
Read an optional fixed-size trailing array: Some + remainder when N
bytes are present, (None, buf) (buffer untouched) when they are not.
“Not enough bytes” is the None case, not an error — this helper is for
fields a protocol defines as legitimately absent at the tail (e.g. DoIP’s
optional 4-byte OEM fields). A partial tail (1..N bytes) also returns
None and leaves the bytes in place, so a subsequent
Decode::decode_exact surfaces them as
TrailingBytes.