Skip to main content

osdp/packet/
trailer.rs

1//! Frame trailer — either an 8-bit checksum or a 16-bit CRC, controlled by
2//! the `USE_CRC` bit of the [`super::ControlByte`].
3
4/// Decoded packet trailer.
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub enum Trailer {
7    /// 8-bit two's-complement checksum.
8    Checksum(u8),
9    /// CRC-16/KERMIT (Annex C).
10    Crc(u16),
11}
12
13impl Trailer {
14    /// `true` if this is a CRC trailer.
15    pub const fn is_crc(self) -> bool {
16        matches!(self, Self::Crc(_))
17    }
18}