pub struct SubgroupObjectReader {
extensions_present: bool,
prev_object_id: Option<u64>,
}Expand description
Stateful reader for the object fields on a subgroup stream.
Object IDs on a subgroup stream are delta-encoded against the
previous Object ID, and whether extension headers are present is
fixed by the enclosing SubgroupHeader’s stream type. This reader
carries that context across successive read_object calls.
Fields§
§extensions_present: bool§prev_object_id: Option<u64>Implementations§
Source§impl SubgroupObjectReader
impl SubgroupObjectReader
Sourcepub fn new(header: &SubgroupHeader) -> Self
pub fn new(header: &SubgroupHeader) -> Self
Create a reader from a parsed subgroup header.
Sourcepub fn read_object(
&mut self,
buf: &mut impl Buf,
) -> Result<SubgroupObject, CodecError>
pub fn read_object( &mut self, buf: &mut impl Buf, ) -> Result<SubgroupObject, CodecError>
Decode the next object from buf. Caller is responsible for
ensuring the buffer contains a complete object (draft-14 objects
are length-delimited by the payload-length field, so the buffer
boundary is known once the header portion has been consumed).
Sourcepub fn write_object(
&mut self,
object: &SubgroupObject,
buf: &mut impl BufMut,
) -> Result<(), CodecError>
pub fn write_object( &mut self, object: &SubgroupObject, buf: &mut impl BufMut, ) -> Result<(), CodecError>
Serialize a subgroup object using the reader’s delta state. Intended
for senders that want to build a stream incrementally — tracks
prev_object_id so successive calls produce correct deltas.
Returns an error if object.object_id <= prev_object_id, which
would produce an invalid delta.
Trait Implementations§
Source§impl Clone for SubgroupObjectReader
impl Clone for SubgroupObjectReader
Source§fn clone(&self) -> SubgroupObjectReader
fn clone(&self) -> SubgroupObjectReader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more