Skip to main content

RosMessage

Trait RosMessage 

Source
pub trait RosMessage:
    Sized
    + Serialize
    + Deserialize {
    const TYPE_NAME: &'static str;
    const TYPE_HASH: &'static str;
    const SERIALIZATION_FORMAT_ID: SerializationFormatId = nros_serdes::format::SerializationFormatId::Cdr;
    const STAMP_OFFSET: Option<usize> = None;
    const MAX_SERIALIZED_BOUND: Option<usize> = None;
}
Expand description

Trait for ROS message types

Identifies a ROS message type by its DDS type name and RIHS hash. All message types implement Serialize and Deserialize.

Required Associated Constants§

Source

const TYPE_NAME: &'static str

Full ROS type name in DDS format

Example: "std_msgs::msg::dds_::String_"

Source

const TYPE_HASH: &'static str

RIHS (ROS Interface Hashing Standard) type hash

Used for type validation between publishers and subscribers. Format: 64-character hex string (SHA-256)

Provided Associated Constants§

Source

const SERIALIZATION_FORMAT_ID: SerializationFormatId = nros_serdes::format::SerializationFormatId::Cdr

RFC-0088 — the serialization format this message’s bytes are in.

Defaulted, on purpose. A required associated type here would force a line onto every hand-written message in every user crate, which is the decision phase-380 W4 already made and reverted once: tightening the message contract to serve a build assertion broke examples/linux/rust/custom-msg, the documented hand-written-message pattern. A defaulted const costs existing implementors nothing and still answers at compile time, which is all the assertion needs.

It lives on RosMessage rather than nros_serdes::schema::Message because only this trait is universal: MessageForRmw requires a schema only under cfg(rmw_needs_type_descriptors) (Cyclone), so a check keyed on the schema would be absent under zenoh and XRCE — and absent under uORB, which is the one backend the check exists for.

Codegen emits an override only for a non-CDR format.

Source

const STAMP_OFFSET: Option<usize> = None

RFC-0052 / phase-296 W3a — byte offset of header.stamp.sec within this type’s serialized CDR payload (encapsulation header included), or None when the type has no leading std_msgs/Header / builtin_interfaces/Time. Codegen-const, never runtime introspection: CDR here is little-endian with a 4-byte encapsulation header and Time { i32 sec; u32 nanosec } is 4-byte aligned, so a Header-leading (or Time-leading) type carries sec at byte 4 and nanosec at byte 8. On-target max_age monitors peek these two words from the raw receive buffer before deserialization.

Source

const MAX_SERIALIZED_BOUND: Option<usize> = None

Issue 1179 / phase-498 W3 – the largest serialized size of this type, over XCDR1 and XCDR2, or None when no bound exists (an unbounded member) or nobody stated one.

Codegen emits nros_serdes::size::max_serialized_bound::<Self>(), the same const fn over the schema in the same generated file. It is computed, never a copied number, so it cannot drift from the schema.

It lives HERE, not only on nros_serdes::schema::Message, for the reason SERIALIZATION_FORMAT_ID does: RosMessage is the one universal trait. MessageForRmw requires a schema only on a backend declaring type-descriptors (Cyclone), so on zenoh and XRCE a registration site could not read the bound, and every default receive buffer there took the image-wide size whatever its type. Defaulted, so a hand-written message (examples/linux/rust/custom-msg) still compiles and keeps exactly that default; it may state its own bound by overriding this.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RosMessage for AddDiagnosticsRequest

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::srv::dds_::AddDiagnostics_Request_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for AddDiagnosticsResponse

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::srv::dds_::AddDiagnostics_Response_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Bool

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Bool_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Byte

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Byte_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for ByteMultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::ByteMultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Char

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Char_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for ColorRGBA

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::ColorRGBA_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for DiagnosticArray

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::msg::dds_::DiagnosticArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const STAMP_OFFSET: Option<usize>

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for DiagnosticStatus

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::msg::dds_::DiagnosticStatus_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Duration

Source§

const TYPE_NAME: &'static str = "builtin_interfaces::msg::dds_::Duration_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Empty

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Empty_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Float32

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Float32_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Float64

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Float64_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Float32MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Float32MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Float64MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Float64MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Header

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Header_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const STAMP_OFFSET: Option<usize>

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int8

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int8_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int8MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int8MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int16

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int16_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int32

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int32_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int64

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int64_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int16MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int16MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int32MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int32MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Int64MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::Int64MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for KeyValue

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::msg::dds_::KeyValue_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for MultiArrayDimension

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::MultiArrayDimension_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for MultiArrayLayout

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::MultiArrayLayout_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for SelfTestRequest

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::srv::dds_::SelfTest_Request_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for SelfTestResponse

Source§

const TYPE_NAME: &'static str = "diagnostic_msgs::srv::dds_::SelfTest_Response_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for String

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::String_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for Time

Source§

const TYPE_NAME: &'static str = "builtin_interfaces::msg::dds_::Time_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt8

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt8_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt8MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt8MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt16

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt16_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt32

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt32_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt64

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt64_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt16MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt16MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt32MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt32MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Source§

impl RosMessage for UInt64MultiArray

Source§

const TYPE_NAME: &'static str = "std_msgs::msg::dds_::UInt64MultiArray_"

Source§

const TYPE_HASH: &'static str = "TypeHashNotSupported"

Source§

const MAX_SERIALIZED_BOUND: Option<usize>

Implementors§