Skip to main content

WcharWidth

Enum WcharWidth 

Source
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

Source

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.

Trait Implementations§

Source§

impl Clone for WcharWidth

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WcharWidth

Source§

impl Debug for WcharWidth

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WcharWidth

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for WcharWidth

Source§

impl PartialEq for WcharWidth

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WcharWidth

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.