pub struct FetchObjectReader { /* private fields */ }Expand description
Stateful resolver for the Objects on one draft-16 fetch stream.
Draft-16 Section 10.4.4.1 lets an Object leave its Group ID, Subgroup ID,
Object ID or Priority off the wire and take the value from the Object before
it, so the fields of a fetch object are only meaningful in stream order.
This carries that running state; FetchObjectHeader carries only what the
bytes said.
Unlike a subgroup stream, nothing here is a delta: a field that is on the wire replaces the running value outright, and a field that is absent either repeats it or steps it by one, as Table 5 and Table 6 say.
Implementations§
Source§impl FetchObjectReader
impl FetchObjectReader
Sourcepub fn new() -> Self
pub fn new() -> Self
A reader positioned before the first Object of a fetch stream, with no prior Object to inherit from.
Sourcepub fn resolve(
&mut self,
header: &FetchObjectHeader,
) -> Result<FetchObjectLocation, CodecError>
pub fn resolve( &mut self, header: &FetchObjectHeader, ) -> Result<FetchObjectLocation, CodecError>
Resolve one Object’s Location against the Object before it, advancing the running state.
Errors with CodecError::InvalidField when the first Object of the
stream leaves out a Group ID or an Object ID, or names the prior
Object’s Subgroup ID: draft-16 Section 10.4.4.1 makes a first Object
that “uses a flag that references fields in the prior Object” a
PROTOCOL_VIOLATION, and for these three fields there is no value to
produce even if it were not. An absent Priority is the same violation by
the draft’s letter and is reported by
FetchObjectHeader::references_prior_object, but it is resolvable —
the Location simply carries no priority — so it is not refused here.
Errors with CodecError::InvalidField when a Subgroup ID one greater
than the prior Object’s would not fit a varint.
A FetchEndOfRange marker takes part in the running state like any
other Object: Section 10.4.4.2 gives it a Location, and it is a
“serialized Object” in the same section’s words, so the Object after it
inherits its Group ID and steps from its Object ID.
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