Expand description
Static field schema for runtime introspection.
Each generated message type exposes its CDR field layout as a
&'static [Field] slice plus a &'static str ROS type name via the
Message trait. Backends that need to construct type descriptors at
runtime (Cyclone DDS dynamic types, FastRTPS DynamicTypeBuilder, …) walk
this static metadata instead of pulling in per-RMW codegen at compile
time.
All schema items are &'static / Copy / contain no allocations,
keeping the surface usable on no_std + alloc-free embedded targets.
§Example
use nros_serdes::schema::{Field, FieldType, Message};
/// Hand-rolled mirror of `std_msgs/msg/Int32`.
pub struct Int32 {
pub data: i32,
}
impl Message for Int32 {
const TYPE_NAME: &'static str = "std_msgs/msg/Int32";
const FIELDS: &'static [Field] = &[Field {
name: "data",
ty: FieldType::Int32,
offset: 0,
}];
}
assert_eq!(Int32::FIELDS.len(), 1);
assert!(matches!(Int32::FIELDS[0].ty, FieldType::Int32));Structs§
- Field
- One field of a ROS message, in declaration order.
- Nested
Type - Metadata for a nested struct field.
Enums§
- Field
Type - CDR / ROS-IDL type of a single field.
Traits§
- Message
- Trait implemented by every generated ROS message type for runtime introspection.