Skip to main content

ServiceMsg

Trait ServiceMsg 

Source
pub trait ServiceMsg:
    'static
    + Send
    + Sync {
    type Request: TypeSupport;
    type Response: TypeSupport;

    // Required method
    fn type_name() -> &'static str;

    // Provided methods
    fn type_support() -> *const c_void { ... }
    fn type_hash() -> Result<String> { ... }
}
Expand description

Trait for ROS2 service message types.

Services consist of a request and response message pair.

Required Associated Types§

Source

type Request: TypeSupport

The request message type.

Source

type Response: TypeSupport

The response message type.

Required Methods§

Source

fn type_name() -> &'static str

Returns the type name in DDS format.

Example: "example_interfaces::srv::dds_::AddTwoInts_"

This is used for Zenoh key expressions and type matching.

Provided Methods§

Source

fn type_support() -> *const c_void

Returns an opaque pointer to the service type support structure.

Source

fn type_hash() -> Result<String>

Returns the RIHS01 type hash for this message type.

§Implementation
  • For RCL: Returns empty string (hash is handled by rosidl typesupport)
  • For Zenoh: Computes hash from TypeDescription

The hash format is: RIHS01_<64_character_hex_sha256>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§