Skip to main content

ps_ecc/reed_solomon/methods/
parity.rs

1use crate::ReedSolomon;
2
3impl ReedSolomon {
4    /// Returns the error-correction capability of this codec: the number
5    /// of byte errors a codeword can recover from.
6    #[inline]
7    #[must_use]
8    pub const fn parity(&self) -> u8 {
9        self.parity
10    }
11}
12
13#[cfg(test)]
14mod tests {
15    use crate::{RSConstructorError, ReedSolomon};
16
17    #[test]
18    fn test_parity() -> Result<(), RSConstructorError> {
19        let rs = ReedSolomon::new(8)?;
20
21        assert_eq!(rs.parity(), 8);
22
23        Ok(())
24    }
25}