pub struct FramedRecvStream {
inner: RecvStream,
buf: BytesMut,
tracking: Option<(TrackObjects, u64)>,
}Expand description
A framed reader for a recv stream. Handles MoQT varint-length decoding.
Fields§
§inner: RecvStream§buf: BytesMut§tracking: Option<(TrackObjects, u64)>The record this stream’s objects are measured against, and the Group ID its header named.
One group for the whole stream: a subgroup header names it once and no
object header repeats it. None on a stream that was never given one —
a stream for an alias no live binding names, and every stream built
outside Connection::accept_subgroup_stream — and such a stream reads
exactly as it did before this existed.
Implementations§
Source§impl FramedRecvStream
impl FramedRecvStream
Sourcepub fn new(inner: RecvStream) -> Self
pub fn new(inner: RecvStream) -> Self
Create a new framed receive stream.
Sourcefn measure_objects_against(&mut self, objects: TrackObjects, group: u64)
fn measure_objects_against(&mut self, objects: TrackObjects, group: u64)
Measure this stream’s objects against objects, all of them in group.
Called by Connection::accept_subgroup_stream once the header has been
read, which is the only point at which both the track and the group are
known.
Sourcefn note_subgroup_object(
&self,
header: &ObjectHeader,
) -> Result<(), ConnectionError>
fn note_subgroup_object( &self, header: &ObjectHeader, ) -> Result<(), ConnectionError>
Record or judge one object this stream carried.
The whole of Section 8.1.1.1’s rule that a single header cannot settle: the object’s Group ID is the stream’s, its Object ID is its own, and what they are measured against is everything the track has carried on any stream.
Sourceasync fn fill(&mut self) -> Result<bool, ConnectionError>
async fn fill(&mut self) -> Result<bool, ConnectionError>
Read more data from the stream into the internal buffer.
Sourceasync fn ensure(&mut self, n: usize) -> Result<(), ConnectionError>
async fn ensure(&mut self, n: usize) -> Result<(), ConnectionError>
Ensure at least n bytes are available in the buffer.
Sourcepub async fn read_control(
&mut self,
capture_raw: bool,
) -> Result<(AnyControlMessage, Option<Vec<u8>>), ConnectionError>
pub async fn read_control( &mut self, capture_raw: bool, ) -> Result<(AnyControlMessage, Option<Vec<u8>>), ConnectionError>
Read a control message from the stream.
When capture_raw is true, the returned tuple includes a clone of the
framed wire bytes (for observer emission). When false, the second
element is None and the payload clone is skipped.
Sourcepub async fn read_subgroup_header(
&mut self,
) -> Result<AnySubgroupHeader, ConnectionError>
pub async fn read_subgroup_header( &mut self, ) -> Result<AnySubgroupHeader, ConnectionError>
Read a subgroup stream header.
Sourcepub async fn read_fetch_header(
&mut self,
) -> Result<AnyFetchHeader, ConnectionError>
pub async fn read_fetch_header( &mut self, ) -> Result<AnyFetchHeader, ConnectionError>
Read a fetch response header.
Sourcepub async fn read_subgroup_object(
&mut self,
) -> Result<SubgroupObject, ConnectionError>
pub async fn read_subgroup_object( &mut self, ) -> Result<SubgroupObject, ConnectionError>
Read the next draft-08 subgroup object (header + payload). Since draft-08 subgroup objects are stateless, this does not require any prior header-decoding state.
Sourcepub async fn read_fetch_object(
&mut self,
) -> Result<FetchObject, ConnectionError>
pub async fn read_fetch_object( &mut self, ) -> Result<FetchObject, ConnectionError>
Read the next draft-08 fetch object (header + payload).