Skip to content

Commit 29103c7

Browse files
committed
docs: add doc comments to all public functions
1 parent 7850510 commit 29103c7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/lib.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub enum ParserError {
3333
Cea608AfterCea708,
3434
/// Failed to validate the checksum
3535
ChecksumFailed,
36-
/// Sequence count differs between the header and the footer. Usuall indicates this packet was
36+
/// Sequence count differs between the header and the footer. Usually indicates this packet was
3737
/// spliced together incorrectly.
3838
SequenceCountMismatch,
3939
}
@@ -109,32 +109,39 @@ static FRAMERATES: [Framerate; 8] = [
109109
},
110110
];
111111

112+
/// A framerate as found in a CDP.
112113
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
113114
pub struct Framerate {
114115
id: u8,
115116
numer: u32,
116117
denom: u32,
117118
}
118119

120+
/// A CDP framerate.
119121
impl Framerate {
122+
/// Create a [`Framerate`] from an identifier as found in a CDP.
120123
pub fn from_id(id: u8) -> Option<Framerate> {
121124
FRAMERATES.iter().find(|f| f.id == id).copied()
122125
}
123126

127+
/// The identifier for this [`Framerate`] in a CDP.
124128
pub fn id(&self) -> u8 {
125129
self.id
126130
}
127131

132+
/// The numerator component of this [`Framerate`]
128133
pub fn numer(&self) -> u32 {
129134
self.numer
130135
}
131136

137+
/// The denominator component of this [`Framerate`]
132138
pub fn denom(&self) -> u32 {
133139
self.denom
134140
}
135141
}
136142

137-
pub struct Flags {
143+
/// A set of flags available in a CDP.
144+
struct Flags {
138145
time_code: bool,
139146
cc_data: bool,
140147
svc_info: bool,
@@ -198,6 +205,7 @@ impl From<Flags> for u8 {
198205
}
199206
}
200207

208+
/// A time code as available in a CDP.
201209
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
202210
pub struct TimeCode {
203211
hours: u8,
@@ -208,6 +216,7 @@ pub struct TimeCode {
208216
drop_frame: bool,
209217
}
210218

219+
/// Parses CDP packets.
211220
#[derive(Debug, Default)]
212221
pub struct CDPParser {
213222
cc_data_parser: cea708_types::CCDataParser,
@@ -446,14 +455,17 @@ impl CDPParser {
446455
*self = Self::default();
447456
}
448457

458+
/// The latest CDP time code that has been parsed
449459
pub fn time_code(&self) -> Option<TimeCode> {
450460
self.time_code
451461
}
452462

463+
/// The latest CDP framerate that has been parsed
453464
pub fn framerate(&self) -> Option<Framerate> {
454465
self.framerate
455466
}
456467

468+
/// The latest CDP sequence number that has been parsed
457469
pub fn sequence(&self) -> u16 {
458470
self.sequence
459471
}
@@ -463,6 +475,7 @@ impl CDPParser {
463475
self.cc_data_parser.pop_packet()
464476
}
465477

478+
/// Pop the list of [`cea708_types::Cea608`] contained in this packet
466479
pub fn cea608(&mut self) -> Option<&[cea708_types::Cea608]> {
467480
self.cc_data_parser.cea608()
468481
}

0 commit comments

Comments
 (0)