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: u16Reserved extra flags (uint16, mostly 0).
reader_id: EntityIdReceiver EntityId.
writer_id: EntityIdSender EntityId.
writer_sn: SequenceNumberSequence 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: boolK-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: boolN-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
impl DataSubmessage
Sourcepub fn write_body(&self, little_endian: bool) -> (Vec<u8>, u8)
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.
Sourcepub fn read_body(body: &[u8], little_endian: bool) -> Result<Self, WireError>
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.
Sourcepub fn read_body_with_flags(
body: &[u8],
little_endian: bool,
flags: u8,
) -> Result<Self, WireError>
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
impl Clone for DataSubmessage
Source§fn clone(&self) -> DataSubmessage
fn clone(&self) -> DataSubmessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more