use crate::U32Le;
use core::fmt::{self, Debug, Display, Formatter, LowerHex};
#[cfg(feature = "bytemuck")]
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, Ord, PartialOrd)]
#[cfg_attr(feature = "bytemuck", derive(Pod, Zeroable))]
#[repr(transparent)]
pub struct Crc32(pub U32Le);
impl Crc32 {
pub const ALGORITHM: crc::Algorithm<u32> = crc::CRC_32_ISO_HDLC;
}
impl Display for Crc32 {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{self:#x}")
}
}
impl LowerHex for Crc32 {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
LowerHex::fmt(&self.0, f)
}
}