Expand description
ROS2 type support library
This crate provides core traits and utilities for ROS2 message types, including RIHS01 (ROS Interface Hashing Standard v1) type hash calculation.
§Features
derive: Enable derive macros forTypeDescriptionandRos2Msgnative: Enable native CDR serialization (for Zenoh, iceoryx2, etc.)
§Traits
This crate provides several traits for ROS2 message types:
TypeSupport: For types with type support information and CDR serializationTryClone: For types that can fail cloning (FFI types)ServiceMsg: For ROS2 service types (Request/Response pairs)ActionMsg: For ROS2 action types (Goal/Result/Feedback)ActionGoal,ActionResult: For action service typesGetUUID,GoalResponse,ResultResponse: Helper traits for actions
§Native CDR Serialization
When the native feature is enabled, message types can be serialized/deserialized
using CDR encoding (compatible with DDS/ROS2):
ⓘ
use ros2_types::TypeSupport;
let msg = std_msgs::msg::String { data: "hello".into() };
let bytes = msg.to_bytes()?;
let decoded = std_msgs::msg::String::from_bytes(&bytes)?;Note: When using native feature, message structs must derive
serde::Serialize and serde::Deserialize.
Re-exports§
pub use cdr::CdrSerde;pub use types::FIELD_TYPE_BOOLEAN;pub use types::FIELD_TYPE_BOUNDED_STRING;pub use types::FIELD_TYPE_BOUNDED_WSTRING;pub use types::FIELD_TYPE_BYTE;pub use types::FIELD_TYPE_CHAR;pub use types::FIELD_TYPE_DOUBLE;pub use types::FIELD_TYPE_FIXED_STRING;pub use types::FIELD_TYPE_FIXED_WSTRING;pub use types::FIELD_TYPE_FLOAT;pub use types::FIELD_TYPE_INT8;pub use types::FIELD_TYPE_INT16;pub use types::FIELD_TYPE_INT32;pub use types::FIELD_TYPE_INT64;pub use types::FIELD_TYPE_LONG_DOUBLE;pub use types::FIELD_TYPE_NESTED_TYPE;pub use types::FIELD_TYPE_NOT_SET;pub use types::FIELD_TYPE_STRING;pub use types::FIELD_TYPE_UINT8;pub use types::FIELD_TYPE_UINT16;pub use types::FIELD_TYPE_UINT32;pub use types::FIELD_TYPE_UINT64;pub use types::FIELD_TYPE_WCHAR;pub use types::FIELD_TYPE_WSTRING;pub use serde;
Modules§
Structs§
- Message
Type Name - Information needed to construct a ROS2 message type name
- Sequence
Raw - Raw sequence type for FFI compatibility
- Unsafe
Duration - Represents a duration that may not be safe across all platforms.
- Unsafe
Time - Represents a timestamp that may not be safe across all platforms.
Enums§
- Error
- Errors that can occur during type hash calculation
Traits§
- Action
Goal - Trait for action goal types.
- Action
Msg - Trait for ROS2 action message types.
- Action
Result - Trait for action result types.
- Action
Type Description - Trait for ROS2 action types that can provide a type description for hash computation
- BigArray
- The big array serialization helper trait
- GetUUID
- Trait for types that contain a UUID.
- Goal
Response - Trait for action goal response types.
- Result
Response - Trait for action result response types.
- RosField
Type - Trait for types that can be used as fields in ROS2 messages.
- Service
Msg - Trait for ROS2 service message types.
- Service
Type Description - Trait for ROS2 service types that can provide a type description for hash computation
- TryClone
- Trait for type that can fail cloning
- Type
Description - Trait for types that can provide a ROS2 type description
- Type
Support - Trait for types that have type support information.
Functions§
- calculate_
type_ hash - Calculate the RIHS01 type hash for a type description
- parse_
rihs_ string - Parse a RIHS hash string and extract version and hash value
Type Aliases§
- Result
- Result type for type hash operations