Skip to main content

TopicType

Trait TopicType 

Source
pub trait TopicType: Sized + TypeSupport<Rust = Self> {
    const TYPE_NAME: &'static str;
    const EXTENSIBILITY: Extensibility;
    const KEYED: bool;

    // Provided methods
    fn to_payload(
        &self,
        encoding: Encoding,
        order: ByteOrder,
    ) -> Result<Vec<u8>, Error> { ... }
    fn from_payload(buf: &[u8]) -> Result<Self, Error> { ... }
    fn key_holder(&self) -> Result<Vec<u8>, Error> { ... }
    fn key_hash(&self) -> Result<[u8; 16], Error> { ... }
}
Expand description

A type a DDS DataWriter publishes: a generated struct or union that is not @nested (DDS-XTypes 7.3.1.2.1.7 and 7.3.1.2.1.16).

Required Associated Constants§

Source

const TYPE_NAME: &'static str

The fully qualified name of the type ("Module::Type").

Source

const EXTENSIBILITY: Extensibility

The extensibility kind (@final, @appendable, @mutable).

Source

const KEYED: bool

Whether the type has key members.

Provided Methods§

Source

fn to_payload( &self, encoding: Encoding, order: ByteOrder, ) -> Result<Vec<u8>, Error>

The RTPS SerializedPayload of self: the encapsulation header of encoding (which must be Encoding::Xcdr1 or Encoding::Xcdr2) and the extensibility of the type, the value, and the padding to 4 octets (DDS-XTypes 7.4.3.5.3 rule 1, DDSI-RTPS 10).

Source

fn from_payload(buf: &[u8]) -> Result<Self, Error>

Reads a value from an RTPS SerializedPayload. Its format must be the one of the extensibility of the type: PL_CDR or PL_CDR2 for a mutable type, PLAIN_CDR or DELIMITED_CDR for an appendable one, PLAIN_CDR or PLAIN_CDR2 for a final one.

Source

fn key_holder(&self) -> Result<Vec<u8>, Error>

The PLAIN_CDR2 big endian serialization of the key holder of self (DDS-XTypes 7.6.8, step 4).

Source

fn key_hash(&self) -> Result<[u8; 16], Error>

The key hash of self (DDS-XTypes 7.6.8, step 5): the key holder padded with zeros when the largest one fits in 16 octets, its MD5 otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§