pub fn decode(received: &[u8], parity: u8) -> Result<Codeword<'_>, DecodeError>Expand description
Verifies the error-correcting code and returns the message.
Correctable corruption is repaired. For codewords longer than 255 bytes,
the parity argument is ignored, since the header records the parity, and
bytes beyond the full length recorded in the header are discarded, so
input rejected by validate may still decode
successfully.
ยงErrors
For codewords of at most 255 bytes:
InsufficientParityBytesis returned ifparity > length / 2.RSConstructorErroris returned ifparityotherwise exceedscrate::MAX_PARITY.RSDecodeErroris returned if decoding fails.
For longer codewords:
LongEccDecodeErroris returned if decoding fails.