pub struct SubgroupObjectReader { /* private fields */ }Implementations§
Source§impl SubgroupObjectReader
impl SubgroupObjectReader
pub fn new(header: &SubgroupHeader) -> Self
pub fn read_object( &mut self, buf: &mut impl Buf, ) -> Result<SubgroupObject, CodecError>
Sourcepub fn read_object_meta(
&mut self,
buf: &mut impl Buf,
) -> Result<SubgroupObjectMeta, CodecError>
pub fn read_object_meta( &mut self, buf: &mut impl Buf, ) -> Result<SubgroupObjectMeta, CodecError>
Decode the next object’s framing without copying its payload.
Consumes exactly the bytes Self::read_object consumes and leaves
the same delta state behind, so the two are interchangeable on a
given stream.
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 an object, producing the correct delta encoding.
A zero payload_length writes the object’s status, defaulting to
ObjectStatus::Normal when it is None. The status is typed, so
every value that can reach this method is one draft-18 assigns and one
Self::read_object accepts; there is no status-related error to
return.
Errors with CodecError::InvalidField when object.object_id is
not strictly greater than the previously written object’s ID, since
no valid delta exists for that case.
Errors with CodecError::InvalidField when payload_length is not
exactly payload.len(). The declared length is written ahead of the
payload, so a mismatch is a frame Self::read_object cannot parse
and one no caller could fix by appending bytes.
Trait Implementations§
Source§impl Clone for SubgroupObjectReader
impl Clone for SubgroupObjectReader
Source§fn clone(&self) -> SubgroupObjectReader
fn clone(&self) -> SubgroupObjectReader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more