pub trait Message: Sized {
const TYPE_NAME: &'static str;
const FIELDS: &'static [Field];
const MAX_SERIALIZED_SIZE_XCDR1: Option<usize> = _;
const MAX_SERIALIZED_SIZE_XCDR2: Option<usize> = _;
const IS_PLAIN: bool = _;
}Expand description
Trait implemented by every generated ROS message type for runtime introspection.
Provides the ROS type name plus the static field schema. Implementors
also typically implement crate::Serialize + crate::Deserialize
for the CDR fast path; this trait is the introspection surface used
by RMW backends that build type descriptors at runtime.
All items are &'static, so the trait is fully usable in no_std +
alloc-free environments. The blanket bound is just Sized — no
Serialize / Deserialize super-bound, so verification-only mirror
types (nros-ghost-types) and CycloneDDS-only “descriptor probe”
types can implement Message without dragging the CDR codecs in.
Required Associated Constants§
Provided Associated Constants§
Sourceconst MAX_SERIALIZED_SIZE_XCDR1: Option<usize> = _
const MAX_SERIALIZED_SIZE_XCDR1: Option<usize> = _
Phase 380 — the largest this type can serialize to, per encoding, or
None when it is unbounded.
PROVIDED, computed from Self::FIELDS by crate::size, so a generated
message gets it for free and cannot state a number that disagrees with
its own schema. There are two because there are genuinely two: the
encodings pad 8-byte primitives differently and XCDR2 adds a DHEADER per
struct, so one constant would be silently wrong for one of them.
None means “no bound exists”, never “unknown” — do not size a buffer
from a fallback. For an unbounded type ask size::serialized_size about
the message in hand instead.
Sourceconst MAX_SERIALIZED_SIZE_XCDR2: Option<usize> = _
const MAX_SERIALIZED_SIZE_XCDR2: Option<usize> = _
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".