dvb_subtitle/traits.rs
1//! Subtitling-specific traits. `Parse` is provided by `broadcast_common`.
2
3use broadcast_common::Parse;
4
5/// Implemented by every typed subtitling segment; drives
6/// [`crate::any::AnySegment`] dispatch. `SEGMENT_TYPE` is the wire
7/// segment_type this type parses.
8pub trait SegmentDef<'a>: Parse<'a, Error = crate::error::Error> {
9 /// Wire segment_type.
10 const SEGMENT_TYPE: u8;
11 /// Diagnostic name. Convention: SCREAMING_SNAKE, suffix-free —
12 /// `PAGE_COMPOSITION`, `REGION_COMPOSITION`, `OBJECT_DATA`.
13 const NAME: &'static str;
14}