pub enum WcharWidth {
Two,
Four,
}Expand description
How many bytes one Char16 occupies on the wire.
XTypes 1.3 §7.4.1.1.1, Table 31 says two, and two of the three
measured implementations write two everywhere. RTI Connext 7.7 writes
four under XCDR1 — measured 2026-08-09 with
@final struct WCh { wchar c; octet tail; }, c = U+0061: RTI’s
XCDR1 payload is 61000000 ab little endian and 00000061 ab big
endian, against 6100 ab / 0061 ab from Cyclone, Fast DDS and
RTI’s own XCDR2. It is the same character width RTI’s XCDR1 wstring
uses, which is why the two are one setting and not two —
zerodds_ast_layout::WstringLengthPolicy::character_width is where
the width is chosen, and this enum is how it reaches the byte layer.
A width is not a formatting difference. A wchar read two bytes wide
out of a four-byte field returns the wrong character and leaves
every member after it two bytes out of place.
Variants§
Two
Two bytes, one UTF-16 code unit. Table 31, and what three of the four measured (vendor, encoding version) pairs write.
Four
Four bytes, one UTF-16 code unit zero-extended. RTI Connext under XCDR1.
Implementations§
Source§impl WcharWidth
impl WcharWidth
Sourcepub const fn bytes(self) -> usize
pub const fn bytes(self) -> usize
The width in bytes, which is also the alignment under
WcharFraming::Fixed: a Char16 is a primitive and aligns to
its own size, capped by MAXALIGN. Under
WcharFraming::GiopLengthPrefixed it is the count in the
leading octet and the alignment is one.