#![no_std]
#![forbid(unsafe_code)]
pub use crc_catalog::algorithm::*;
pub use crc_catalog::{Algorithm, Width};
mod crc128;
mod crc16;
mod crc32;
mod crc64;
mod crc8;
mod table;
mod util;
pub struct Slice16<W: Width>(core::marker::PhantomData<W>);
pub struct Bytewise<W: Width>(core::marker::PhantomData<W>);
pub struct NoTable<W: Width>(core::marker::PhantomData<W>);
impl<W: Width> crate::private::Sealed for Slice16<W> {}
impl<W: Width> crate::private::Sealed for Bytewise<W> {}
impl<W: Width> crate::private::Sealed for NoTable<W> {}
impl<W: Width> crate::Implementation for Slice16<W> {
type Width = W;
type Table = [[W; 256]; 16];
}
impl<W: Width> crate::Implementation for Bytewise<W> {
type Width = W;
type Table = [W; 256];
}
impl<W: Width> crate::Implementation for NoTable<W> {
type Width = W;
type Table = ();
}
mod private {
pub trait Sealed {}
impl<W: super::Width> Sealed for W {}
}
pub trait Implementation: private::Sealed {
type Width: Width;
type Table;
}
pub struct Crc<I: Implementation> {
pub algorithm: &'static Algorithm<I::Width>,
table: I::Table,
}
#[derive(Clone)]
pub struct Digest<'a, I: Implementation> {
crc: &'a Crc<I>,
value: I::Width,
}