dvb_common/lib.rs
1//! Shared primitives for the dvb_si / dvb_t2mi / dvb_bbframe family.
2//!
3//! See individual modules for documentation: the [`Parse`] / [`Serialize`]
4//! traits every wire type implements, the MPEG-2 [`crc32_mpeg2`] CRC, and the
5//! [`bcd`] / [`time`] codecs.
6//!
7//! # Quick start
8//! ```
9//! use dvb_common::{bcd, crc32_mpeg2};
10//!
11//! // Binary-coded decimal (as used in MJD/BCD time fields):
12//! assert_eq!(bcd::from_bcd_byte(0x42), Some(42));
13//! assert_eq!(bcd::to_bcd_byte(42), Some(0x42));
14//!
15//! // MPEG-2 CRC-32 over a section body (deterministic):
16//! let crc = crc32_mpeg2::compute(&[0xDE, 0xAD, 0xBE, 0xEF]);
17//! assert_eq!(crc, crc32_mpeg2::compute(&[0xDE, 0xAD, 0xBE, 0xEF]));
18//! ```
19
20#![forbid(unsafe_code)]
21#![warn(missing_docs)]
22#![cfg_attr(docsrs, feature(doc_cfg))]
23
24pub mod bcd;
25pub mod crc32_mpeg2;
26pub mod time;
27pub mod traits;
28
29pub use traits::{Parse, Serialize};