pub struct ParticipantMessageData {
pub participant_guid: [u8; 16],
pub kind: u32,
pub data: Vec<u8>,
}Expand description
ParticipantMessageData (DDSI-RTPS 2.5 §9.6.3.1) — payload of the
DCPSParticipantMessage topic.
Fields§
§participant_guid: [u8; 16]16-byte GUID of the sender (prefix + EntityId::PARTICIPANT). Even though the spec says “prefix”, Cyclone and Fast-DDS write the full GUID here; we follow.
kind: u32Liveliness kind (see PARTICIPANT_MESSAGE_DATA_KIND_*).
data: Vec<u8>Opaque token. On MANUAL_BY_TOPIC a topic hash, otherwise empty.
Implementations§
Source§impl ParticipantMessageData
impl ParticipantMessageData
Sourcepub fn automatic(prefix: GuidPrefix) -> Self
pub fn automatic(prefix: GuidPrefix) -> Self
Constructor for an AUTOMATIC heartbeat (data empty).
Sourcepub fn manual_by_participant(prefix: GuidPrefix) -> Self
pub fn manual_by_participant(prefix: GuidPrefix) -> Self
Constructor for a MANUAL_BY_PARTICIPANT heartbeat (data empty).
Sourcepub fn manual_by_topic(prefix: GuidPrefix, topic_token: Vec<u8>) -> Self
pub fn manual_by_topic(prefix: GuidPrefix, topic_token: Vec<u8>) -> Self
Constructor for ZeroDDS MANUAL_BY_TOPIC (data = topic token).
Sourcepub fn to_cdr(&self, little_endian: bool) -> Result<Vec<u8>, WireError>
pub fn to_cdr(&self, little_endian: bool) -> Result<Vec<u8>, WireError>
Encodes to CDR bytes (with a 4-byte encapsulation header).
little_endian = true → ENCAPSULATION_CDR_LE, otherwise BE.
§Errors
WireError::ValueOutOfRange if data.len() > MAX_DATA_LEN.
Sourcepub fn from_cdr(bytes: &[u8]) -> Result<Self, WireError>
pub fn from_cdr(bytes: &[u8]) -> Result<Self, WireError>
Decodes from CDR bytes (with an encapsulation header).
Accepts 0x0000/0x0001 (XCDR1 plain) and 0x0006/0x0007
(XCDR2 plain). Other encapsulation kinds → error.
Tolerant of the 12-byte prefix-only encoding (pads with 0 to 16 bytes).
§Errors
UnsupportedEncapsulationon non-CDR encapsulationUnexpectedEofif the bytes are too short for header / bodyValueOutOfRangeifdata.len > MAX_DATA_LEN
Sourcepub fn prefix(&self) -> GuidPrefix
pub fn prefix(&self) -> GuidPrefix
Returns the GuidPrefix (first 12 bytes).
Sourcepub fn is_vendor_kind(&self) -> bool
pub fn is_vendor_kind(&self) -> bool
true if the kind value is vendor-specific (MSB set).
Trait Implementations§
Source§impl Clone for ParticipantMessageData
impl Clone for ParticipantMessageData
Source§fn clone(&self) -> ParticipantMessageData
fn clone(&self) -> ParticipantMessageData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more