/// CRCs from this module are implemented in C instead of Rust
pub mod ffi;

mod crc_32;
pub use crc_32::*;

pub const CHECK_DATA: [u8; 9] = *b"123456789";

pub trait Crc: Sized {
    type Input: ?Sized;
    type Checksum: Eq + Default + Copy;

    fn new() -> Self;
    fn process(&mut self, data: &Self::Input);
    fn shift_reg(&mut self) -> &mut Self::Checksum;
    #[inline]
    fn checksum(data: &Self::Input) -> Self::Checksum {
        let mut c = Self::new();
        c.process(data);
        *c.shift_reg()
    }
}
