pub struct SectionSetCollector { /* private fields */ }Expand description
Generic collector for long-form section_number/last_section_number
sequences.
The constructor SectionSetCollector::new uses the default cap
DEFAULT_MAX_PARTIAL_KEYS; the cap is configurable via
with_max_partial_keys.
Implementations§
Source§impl SectionSetCollector
impl SectionSetCollector
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty collector with the default cap
(DEFAULT_MAX_PARTIAL_KEYS).
Sourcepub fn with_max_partial_keys(self, max_partial_keys: usize) -> Self
pub fn with_max_partial_keys(self, max_partial_keys: usize) -> Self
Replace the partial-key cap (default DEFAULT_MAX_PARTIAL_KEYS).
Sections for new keys are skipped when the map is full, until
clear frees capacity.
Sourcepub fn push_section(
&mut self,
bytes: impl AsRef<[u8]>,
) -> CollectResult<Option<CompleteSectionSet>>
pub fn push_section( &mut self, bytes: impl AsRef<[u8]>, ) -> CollectResult<Option<CompleteSectionSet>>
Push one complete section. Returns Some only when the logical section
set has become complete for the first time at this version.
§Errors
Returns a CollectError if the bytes are not a valid long-form
section or if the section set becomes internally inconsistent. Treat the
error as applying to this section only unless your application wants
strict stream-fail behavior.
Sourcepub fn push_section_with_pid(
&mut self,
pid: Option<u16>,
bytes: impl AsRef<[u8]>,
) -> CollectResult<Option<CompleteSectionSet>>
pub fn push_section_with_pid( &mut self, pid: Option<u16>, bytes: impl AsRef<[u8]>, ) -> CollectResult<Option<CompleteSectionSet>>
Push one complete section with PID context.
The PID is folded into the section-set key so tables with identical table id/extension on different PIDs do not collide.