Expand description
Reed-Solomon error-correcting codes over GF(256).
The crate offers three layers of API:
- The free functions
encode,decode, andvalidatepick the appropriate format automatically: messages that fit a single Reed-Solomon codeword (at most255 - 2 * paritybytes) are encoded directly, and longer messages use the long ECC format, which splits the message into segments of at most 255 bytes behind a checksummed header. ReedSolomonencodes, validates, and corrects single codewords, either attached (parity || datain one slice) or detached (parity and data as separate slices).Polynomialandeuclideanexpose the underlying GF(256) polynomial arithmetic.
The parity count parameter is the error-correction capability: the
number of byte errors a codeword can recover from, each costing two
parity bytes. It is capped at MAX_PARITY (63). The detached APIs
instead take the generated parity bytes themselves, capped at
MAX_PARITY_BYTES (126).
Structs§
- Codeword
- A decoded codeword exposing the message bytes.
- Long
EccHeader - The 32-byte header of a long ECC codeword.
- Parity
Bytes - Stack-allocated parity bytes returned by
crate::ReedSolomon::generate_parity. - Polynomial
- A polynomial over GF(256) with at most 255 coefficients.
- Reed
Solomon - A Reed-Solomon codec over GF(256) for codewords of at most 255 bytes.
Enums§
- Cow
- A borrowed-or-owned byte buffer.
- Decode
Error - Errors returned by the free
decodefunction. - EccError
- Umbrella error over encoding and decoding.
- Encode
Error - Errors returned by the free
encodefunction. - Euclidean
Error - Errors returned by
euclidean. - GFError
- Errors of GF(256) field arithmetic.
- Long
EccDecode Error - Errors of long ECC decoding.
- Long
EccEncode Error - Errors of long ECC encoding.
- Long
EccFast Validate Error - Long
EccHeader Constructor Error - Errors returned by
LongEccHeader::new. - Long
EccHeader From Byte Slice Error - Errors returned by
LongEccHeader::from_byte_slice. - Long
EccHeader From Bytes Error - Errors returned by
LongEccHeader::from_bytes. - Overlap
Factor - Approximate number of distinct codewords covering each byte.
- Polynomial
DivError - Errors of polynomial division and remainder.
- Polynomial
From Slice Error - Errors returned when constructing a
Polynomialfrom a slice. - Polynomial
MulError - Errors of polynomial multiplication.
- Polynomial
SetCoefficients Error - Errors returned by
Polynomial::set_coefficients. - Polynomial
XorError - Errors of polynomial XOR with a coefficient iterator.
- RSCompute
Errors Error - Errors returned by
ReedSolomon::compute_errors. - RSConstructor
Error - Errors returned by
ReedSolomon::newand by the detached-parity methods when the parity slice itself is invalid. - RSDecode
Error - Errors returned by the decoding and correction methods of
ReedSolomon. - RSEncode
Error - Errors returned by
ReedSolomon::encode. - RSGenerate
Parity Error - Errors returned by
ReedSolomon::generate_parity.
Constants§
- MAX_
PARITY - Maximum error-correction capability of a Reed-Solomon codec.
- MAX_
PARITY_ BYTES - Maximum parity byte count, equal to
MAX_PARITY * 2.