Skip to main content

RepresentationIdentifier

Enum RepresentationIdentifier 

Source
#[repr(u16)]
pub enum RepresentationIdentifier { CdrBE = 0, CdrLE = 1, PlCdrBE = 2, PlCdrLE = 3, Xcdr2BE = 6, Xcdr2LE = 7, DCdr2BE = 8, DCdr2LE = 9, PlXcdr2BE = 10, PlXcdr2LE = 11, }
Expand description

CDR Representation Identifier (2 bytes)

Per RTPS v2.5 Section 10.5, Table 10.3 and DDS X-Types 1.3 Section 7.6.2.1.2

The representation identifier specifies the encoding format and byte order used for the serialized data payload.

§Supported Encodings

Only plain CDR v1 is supported by this implementation:

  • CdrLE - CDR Little Endian (recommended, default)
  • CdrBE - CDR Big Endian

All other encodings (Parameter List, XCDR v2) will fail during serialization/deserialization.

Variants§

§

CdrBE = 0

CDR Big Endian (v1) - [0x00, 0x00] ✓ Supported

§

CdrLE = 1

CDR Little Endian (v1) - [0x00, 0x01] ✓ Supported

§

PlCdrBE = 2

Parameter List CDR Big Endian - [0x00, 0x02] ✗ Not supported

§

PlCdrLE = 3

Parameter List CDR Little Endian - [0x00, 0x03] ✗ Not supported

§

Xcdr2BE = 6

XCDR v2 Big Endian (X-Types 1.3) - [0x00, 0x06] ✗ Not supported

§

Xcdr2LE = 7

XCDR v2 Little Endian (X-Types 1.3) - [0x00, 0x07] ✗ Not supported

§

DCdr2BE = 8

Delimited CDR v2 Big Endian - [0x00, 0x08] ✗ Not supported

§

DCdr2LE = 9

Delimited CDR v2 Little Endian - [0x00, 0x09] ✗ Not supported

§

PlXcdr2BE = 10

Parameter List XCDR v2 Big Endian - [0x00, 0x0a] ✗ Not supported

§

PlXcdr2LE = 11

Parameter List XCDR v2 Little Endian - [0x00, 0x0b] ✗ Not supported

Implementations§

Source§

impl RepresentationIdentifier

Source

pub const fn is_little_endian(&self) -> bool

Returns true if this representation uses little-endian byte order

Source

pub const fn is_big_endian(&self) -> bool

Returns true if this representation uses big-endian byte order

Source

pub const fn is_plain_cdr(&self) -> bool

Returns true if this is a plain CDR v1 encoding (CdrBE or CdrLE)

Only plain CDR v1 encodings are supported by this implementation.

Source

pub const fn is_supported(&self) -> bool

Returns true if this encoding is supported by the current implementation

Currently only plain CDR v1 (CdrBE, CdrLE) is supported. Parameter List and XCDR v2 encodings are not supported.

Source

pub const fn is_cdr_v1(&self) -> bool

Returns true if this is a CDR v1 encoding (including Parameter List CDR)

Source

pub const fn is_cdr_v2(&self) -> bool

Returns true if this is a CDR v2 / XCDR2 encoding

Source

pub const fn is_parameter_list(&self) -> bool

Returns true if this is a Parameter List encoding

Source

pub const fn to_bytes(&self) -> [u8; 2]

Convert to raw bytes (big-endian as per spec)

Source

pub fn from_bytes(bytes: [u8; 2]) -> Result<Self>

Parse from raw bytes

Trait Implementations§

Source§

impl Clone for RepresentationIdentifier

Source§

fn clone(&self) -> RepresentationIdentifier

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RepresentationIdentifier

Source§

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

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

impl Default for RepresentationIdentifier

Source§

fn default() -> Self

Default to CDR Little Endian (most common for x86/ARM)

Source§

impl PartialEq for RepresentationIdentifier

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for RepresentationIdentifier

Source§

impl Eq for RepresentationIdentifier

Source§

impl StructuralPartialEq for RepresentationIdentifier

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> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.