pub struct DataStreamParser {
buf: BytesMut,
stream_type: DataStreamType,
state: DataStreamState,
draft: DraftVersion,
}Expand description
Stateful inline parser for a MoQT data stream.
Accepts raw byte chunks and emits parsed headers and object headers. The parser buffers partial data and tries to decode when enough bytes are available.
Fields§
§buf: BytesMut§stream_type: DataStreamType§state: DataStreamState§draft: DraftVersionImplementations§
Source§impl DataStreamParser
impl DataStreamParser
Sourcepub fn new(stream_type: DataStreamType, draft: DraftVersion) -> Self
pub fn new(stream_type: DataStreamType, draft: DraftVersion) -> Self
Create a new parser for the given stream type and draft version.
Sourcepub fn feed(&mut self, data: &[u8]) -> Vec<DataParseResult>
pub fn feed(&mut self, data: &[u8]) -> Vec<DataParseResult>
Feed raw bytes into the parser.
Returns a list of parsed results. May return multiple results if the data contains several complete items.
Sourcefn try_parse_header(&mut self) -> Option<Result<DataStreamHeaderKind, String>>
fn try_parse_header(&mut self) -> Option<Result<DataStreamHeaderKind, String>>
Try to parse the stream header from the buffer.
Sourcefn try_parse_object(&mut self) -> Option<Result<AnyObjectHeader, String>>
fn try_parse_object(&mut self) -> Option<Result<AnyObjectHeader, String>>
Try to parse an object header from the buffer.
Note: drafts 14-17 do not have a standalone AnyObjectHeader
variant — their subgroup objects use delta-encoded object IDs
and header-typed extension/properties flags that require stateful
per-stream context (a SubgroupObjectReader). Proxy-side parsing
of those drafts’ object streams would need to track that state
per stream; that work is out of scope here, and this path will
return CodecError::UnsupportedDraft for drafts 14-17.