Skip to main content

DataSubmessage

Struct DataSubmessage 

Source
pub struct DataSubmessage {
    pub extra_flags: u16,
    pub reader_id: EntityId,
    pub writer_id: EntityId,
    pub writer_sn: SequenceNumber,
    pub inline_qos: Option<ParameterList>,
    pub key_flag: bool,
    pub non_standard_flag: bool,
    pub serialized_payload: Arc<[u8]>,
}
Expand description

DATA submessage. Phase 0 supports only the D-flag (data), no Q (no inline QoS), no K, no N.

serialized_payload is Arc<[u8]> (WP 2.0a zero-copy spike). Writers share the payload allocation with CacheChange and all DATA/DATA_FRAG datagrams — clone() on this struct is a pure refcount bump.

Fields§

§extra_flags: u16

Reserved extra flags (uint16, mostly 0).

§reader_id: EntityId

Receiver EntityId.

§writer_id: EntityId

Sender EntityId.

§writer_sn: SequenceNumber

Sequence number of this DATA.

§inline_qos: Option<ParameterList>

Inline-QoS ParameterList (Q-flag, §9.4.5.3.2). None = no Q-flag, no inline-QoS block. Carrier for PID_KEY_HASH (WP 1.B), PID_STATUS_INFO, PID_COHERENT_SET etc.

§key_flag: bool

K-flag (spec §8.3.8.2 Tab. 8.43). true: serialized_payload contains only the @key fields (key-only sample, e.g. a dispose marker). The D-flag can be false at the same time when only the key is sent; in that case serialized_payload is an XCDR-encoded key holder.

§non_standard_flag: bool

N-flag (spec §8.3.8.2 Tab. 8.43, NonStandardPayloadFlag). true: serialized_payload is NOT encoded in the CDR variant implied by representation_identifier (e.g. for DDS-Security-encrypted payloads).

§serialized_payload: Arc<[u8]>

Serialized payload (XCDR2-encoded or vendor-specific).

Implementations§

Source§

impl DataSubmessage

Source

pub fn write_body(&self, little_endian: bool) -> (Vec<u8>, u8)

Encodes the DATA body (without the submessage header) into a Vec. Automatically sets the D-flag and, if applicable, the Q-flag in the flags output (returned), so the caller can fill the submessage header correctly.

Layout: extraFlags(2) + octetsToInlineQos(2) + readerId(4) + writerId(4) + writerSN(8) + [optional InlineQoS PL] + payload.

Source

pub fn read_body(body: &[u8], little_endian: bool) -> Result<Self, WireError>

Decodes the DATA body from a slice. A backward-compat wrapper for callers that carry no Q-flag — inline QoS is ignored.

§Errors

UnexpectedEof on a too-short body.

Source

pub fn read_body_with_flags( body: &[u8], little_endian: bool, flags: u8, ) -> Result<Self, WireError>

Decodes the DATA body taking the submessage flags into account. If flags & DATA_FLAG_INLINE_QOS != 0 the decoder parses the ParameterList after the writerSN, before the payload.

§Errors

UnexpectedEof on a too-short body. ParameterList errors are passed through as WireError.

Trait Implementations§

Source§

impl Clone for DataSubmessage

Source§

fn clone(&self) -> DataSubmessage

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 DataSubmessage

Source§

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

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

impl Eq for DataSubmessage

Source§

impl PartialEq for DataSubmessage

Source§

fn eq(&self, other: &DataSubmessage) -> 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 DataSubmessage

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.