Skip to main content

FetchObjectHeader

Struct FetchObjectHeader 

Source
pub struct FetchObjectHeader {
    pub serialization_flags: VarInt,
    pub group_id_delta: Option<VarInt>,
    pub subgroup_id: Option<VarInt>,
    pub object_id_delta: Option<VarInt>,
    pub publisher_priority: Option<u8>,
    pub properties: Option<Vec<u8>>,
    pub payload_length: VarInt,
}
Expand description

One entry on a draft-23 fetch stream, up to but not including its payload.

{
  Serialization Flags (vi64),
  [Group ID Delta (vi64),]
  [Subgroup ID (vi64),]
  [Object ID Delta (vi64),]
  [Publisher Priority (8),]
  [Properties (..),]
  Object Payload Length (vi64),
  [Object Payload (..),]
}

This holds what is on the wire: the deltas, not the IDs they resolve to. FetchObjectReader resolves them (Section 11.4.1.1 and Section 11.4.2.1).

An entry may be an indicator rather than an Object: Self::end_of_range and Self::end_marker say which.

Fields§

§serialization_flags: VarInt

The raw Serialization Flags value, kept whole because it also names an indicator and because re-encoding must reproduce the publisher’s value.

§group_id_delta: Option<VarInt>

Group ID Delta, present when the flags set 0x08 and on every End of Range indicator.

§subgroup_id: Option<VarInt>

An explicit Subgroup ID, present only when the two low flag bits are 0b11 and the Datagram bit is clear.

§object_id_delta: Option<VarInt>

Object ID Delta, present when the flags set 0x04 and on every End of Range indicator.

§publisher_priority: Option<u8>

Publisher Priority, present when the flags set 0x10.

§properties: Option<Vec<u8>>

Raw properties bytes, excluding their length prefix, and None when the flags leave 0x20 clear.

§payload_length: VarInt

Object Payload Length. Zero, and not on the wire, for End of Group and End of Track.

Implementations§

Source§

impl FetchObjectHeader

Source

pub fn flags(&self) -> u64

The Serialization Flags as a plain integer.

Source

pub fn end_of_range(&self) -> Option<FetchEndOfRange>

Which End of Range indicator this is, or None for anything else.

Source

pub fn end_marker(&self) -> Option<FetchEndMarker>

Which of End of Group and End of Track this is, or None for anything else.

Source

pub fn is_indicator(&self) -> bool

true for any Table 8 indicator, false for an Object.

Source

pub fn subgroup_id_mode(&self) -> u8

The two-bit Subgroup ID mode, flags & 0x03 (Section 11.4.1.1, Table 9). Meaningless when Self::is_datagram is true.

Source

pub fn is_datagram(&self) -> bool

true when the flags set 0x40, marking an Object whose Delivery Mode is Datagram, which has no Subgroup ID.

Source

fn layout(flags: u64) -> Result<FetchObjectLayout, CodecError>

Which fields flags puts on the wire.

Values below 128 are flags. Table 8 defines six values above that, and Section 11.4.1: “If an endpoint receives any other value greater than 127, it MUST close the session with MALFORMED_OBJECT.”

Section 11.4.2: on an End of Range indicator “the Group ID Delta and Object ID Delta fields are always present. Subgroup ID, Priority and Properties are not present.” Figure 29 makes Object Payload Length mandatory and Section 11.4.2 does not list it among the absent fields, so it is present, and written as 0. On End of Group and End of Track “no other fields are present”, so there is no Object Payload Length either.

Source

pub fn decode(buf: &mut impl Buf) -> Result<Self, CodecError>

Decode one fetch entry’s header, leaving the payload in buf.

The flags are validated before any field is read, because they are what says where the fields are.

Source

pub fn encode(&self, buf: &mut impl BufMut) -> Result<(), CodecError>

Serialize the header, refusing one whose fields disagree with its own Serialization Flags.

CodecError::InvalidField when an optional field is present while its flag says absent or the reverse, and for an End of Group or End of Track with a non-zero payload length. Checked before any byte is written.

Trait Implementations§

Source§

impl Clone for FetchObjectHeader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FetchObjectHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FetchObjectHeader

Source§

impl PartialEq for FetchObjectHeader

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FetchObjectHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.