pub struct MessageInfo { /* private fields */ }Expand description
Metadata about a received message
Contains information about the source and timing of a message.
ADOPT-BOUNDED against rclrs’s MessageInfo, which exposes the whole
rmw_message_info_t. This is a flat struct of what an embedded backend can
fill: both timestamps, both sequence numbers and a 24-byte publisher gid.
Whether a message carries it at all is a BACKEND property — zenoh fills it
from the attachment, Cyclone from take_with_info, and a backend that reports
no metadata hands the callback None rather than a zeroed value. How many gid
bytes mean anything is backend-specific too: see publisher_gid.
Implementations§
Source§impl MessageInfo
impl MessageInfo
Sourcepub const fn with_timestamps(source: Time, received: Time) -> Self
pub const fn with_timestamps(source: Time, received: Time) -> Self
Create a MessageInfo with the given timestamps
Sourcepub const fn source_timestamp(&self) -> Time
pub const fn source_timestamp(&self) -> Time
Get the timestamp when the message was published
Sourcepub const fn received_timestamp(&self) -> Time
pub const fn received_timestamp(&self) -> Time
Get the timestamp when the message was received
Sourcepub const fn publication_sequence_number(&self) -> i64
pub const fn publication_sequence_number(&self) -> i64
Get the publication sequence number
Sourcepub const fn reception_sequence_number(&self) -> i64
pub const fn reception_sequence_number(&self) -> i64
Get the reception sequence number
Sourcepub const fn publisher_gid(&self) -> &[u8; 24]
pub const fn publisher_gid(&self) -> &[u8; 24]
Get the publisher’s Global Identifier (GID).
The array is 24 bytes. How many of them MEAN anything is a backend property.
The width is upstream’s (PUBLISHER_GID_SIZE), so this value and the
rmw_gid_t the get_gid_for_publisher vtable slot fills are one type
— and, since issue 1495, one VALUE on the backends that produce either:
- zenoh fills 16 and zero-pads 8. The 16 are XXH3-128 of the
sending entity’s liveliness keyexpr —
rmw_zenoh_cpp’s own derivation, so it is the gid the sender’sget_gidreports and the gidros2 topic info --verboseprints for it, ours or a stock peer’s.RMW_ATTACHMENT_SIZEcarries 16 because that isrmw_zenoh_cpp’s wire layout (its reader REJECTS any other length); the padding is written bypad_publisher_gid. Compare whole arrays anyway. - Cyclone fills 16 and zero-pads 8: the sending WRITER’s GUID,
which is what its
get_gidreports and a DDS graph prints. A stock Humblermw_cyclonedds_cppsubscriber reports something else here (the 8-byte publication handle), so do not compare this field against one read from such a peer. - XRCE and uORB never fill it. A backend that reports no metadata
leaves the
message_info()callback aNone, not a zeroed gid.
An all-zero gid therefore means “this backend did not say” (or, on Cyclone, that the writer unmatched before the take), never “the publisher’s id is zero”.
Sourcepub fn set_source_timestamp(&mut self, ts: Time)
pub fn set_source_timestamp(&mut self, ts: Time)
Set the source timestamp
Sourcepub fn set_received_timestamp(&mut self, ts: Time)
pub fn set_received_timestamp(&mut self, ts: Time)
Set the received timestamp
Sourcepub fn set_publication_sequence_number(&mut self, seq: i64)
pub fn set_publication_sequence_number(&mut self, seq: i64)
Set the publication sequence number
Sourcepub fn set_reception_sequence_number(&mut self, seq: i64)
pub fn set_reception_sequence_number(&mut self, seq: i64)
Set the reception sequence number
Sourcepub fn set_publisher_gid(&mut self, gid: [u8; 24])
pub fn set_publisher_gid(&mut self, gid: [u8; 24])
Set the publisher GID.
Takes the full PUBLISHER_GID_SIZE width. A backend whose identity is
narrower zero-extends it through pad_publisher_gid rather than
building the array itself — see publisher_gid
for what a reader may and may not conclude from the result.
Trait Implementations§
Source§impl Clone for MessageInfo
impl Clone for MessageInfo
Source§fn clone(&self) -> MessageInfo
fn clone(&self) -> MessageInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more