pub struct FetchObjectReader { /* private fields */ }Expand description
Resolves the elided fields of the frames on one FETCH stream.
Draft-17 Section 10.4.4.1, Table 8 defines every field a frame omits as the prior Object’s — a Group ID repeated, an Object ID stepped by one, a Priority carried over — and Table 7 does the same for the Subgroup ID, so no frame after the first can be understood on its own. This holds what the frames so far established, in the two parts the draft keeps separate: Section 10.4.4.2 says that after an End of Range marker the prior Group ID and Object ID are the marker’s, while the prior Subgroup ID and Priority are still “from the last actual Object before the End of Range indicator”.
Nothing here is a delta. The fields that are on the wire hold values rather than differences, which is what separates this from draft-18’s reader of the same name: draft-18 renamed both ID fields to deltas and gave them arithmetic, which is also why this reader needs no Group Order and draft-18’s does.
Implementations§
Source§impl FetchObjectReader
impl FetchObjectReader
Sourcepub fn new() -> Self
pub fn new() -> Self
A reader positioned before the first frame of a fetch stream, with no prior Object to inherit from.
Sourcepub fn read_object_header(
&mut self,
buf: &mut impl Buf,
) -> Result<FetchObject, CodecError>
pub fn read_object_header( &mut self, buf: &mut impl Buf, ) -> Result<FetchObject, CodecError>
Decode the next frame’s header and resolve its fields.
Consumes the header only. The Object Payload is
header.payload_length bytes and stays in buf, so a caller that
forwards payloads never copies them and one that ignores them can skip.
Errors with CodecError::InvalidField when a frame names a field of a
prior Object that does not exist — Section 10.4.4.1: “If the first
Object in the FETCH response uses a flag that references fields in the
prior Object, the Subscriber MUST close the session with a
PROTOCOL_VIOLATION” — and when a Subgroup ID or Object ID one past the
prior one would leave the 64-bit range.
Trait Implementations§
Source§impl Clone for FetchObjectReader
impl Clone for FetchObjectReader
Source§fn clone(&self) -> FetchObjectReader
fn clone(&self) -> FetchObjectReader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more