Skip to main content

RawBytes

Struct RawBytes 

Source
pub struct RawBytes {
    pub data: Vec<u8>,
}
Expand description

An opaque raw byte payload with a configurable type name (via an impl of BytesPayload<T> or a newtype).

Fields§

§data: Vec<u8>

Payload bytes (placed on the wire as-is, no CDR framing).

Implementations§

Source§

impl RawBytes

Source

pub fn new(data: Vec<u8>) -> Self

Constructor.

Trait Implementations§

Source§

impl Clone for RawBytes

Source§

fn clone(&self) -> RawBytes

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 DdsType for RawBytes

Source§

const TYPE_NAME: &'static str = "zerodds::RawBytes"

Fully-qualified topic type name (e.g. "std_msgs::String"). Must match the peer type name exactly (strict matching).
Source§

fn encode(&self, out: &mut Vec<u8>) -> Result<(), EncodeError>

Serializes self into the XCDR2 payload sent as the serialized_payload of a DATA submessage. Default endianness: little-endian (RTPS 2.5 §10.5 RepresentationIdentifier = CDR2_LE = 0x0010). Read more
Source§

fn decode(bytes: &[u8]) -> Result<Self, DecodeError>

Deserializes a little-endian XCDR2 payload. The caller ensures that bytes contains the full sample payload (encapsulation header already stripped). Read more
Source§

const EXTENSIBILITY: Extensibility = Extensibility::Final

XTypes 1.3 §7.4.5 struct extensibility kind. Default Final for backwards compat with pre-EXTENSIBILITY codegen outputs. Spec: zerodds-xcdr2-rust §2.3.
Source§

const HAS_KEY: bool = false

true if the topic type is keyed (at least one member with a @key annotation). Default false — the caller (proc-macro) overrides this for keyed types and also implements Self::encode_key_holder_be. Read more
Source§

const IS_KEYED: bool = Self::HAS_KEY

Spec-aligned alias for Self::HAS_KEY. zerodds-xcdr2-rust §2 references this as IS_KEYED.
Source§

const KEY_HOLDER_MAX_SIZE: Option<usize> = None

Maximum size of the PLAIN_CDR2-BE KeyHolder stream in bytes (XTypes 1.3 §7.6.8.4 step 5). None = not keyed or unbounded (MD5 path). Some(n) with n <= 16 = zero-pad path.
Source§

const IS_NESTED: bool = false

true if the type is annotated with @nested (XTypes 1.3 §7.4.6.3.5). Nested types are only intended as members of other types and MUST NOT be registered as a DDS topic type. DomainParticipant::create_topic rejects registration of nested types with PreconditionNotMet.
Source§

const TYPE_IDENTIFIER: TypeIdentifier = zerodds_types::TypeIdentifier::None

XTypes 1.3 §7.3.4.2 — TypeIdentifier of the type for XTypes-aware discovery + compatibility matching. Default TypeIdentifier::None signals “type-id not provided; reader-writer matching falls back to plain type_name comparison (DDS 1.4 §2.2.3 default path)”. Read more
Source§

fn encode_be(&self, out: &mut Vec<u8>) -> Result<(), EncodeError>

Big-endian variant of Self::encode. The default implementation delegates to Self::encode (no byte swap), since a generic BE re-encode is not possible without type reflection. Codegen overrides this for structures that should genuinely go on the wire as BE. Spec: zerodds-xcdr2-rust §2.4. Read more
Source§

fn decode_be(bytes: &[u8]) -> Result<Self, DecodeError>

Big-endian variant of Self::decode — for a payload whose encapsulation header declared a big-endian representation identifier (CDR_BE = 0x0000, PL_CDR_BE = 0x0002, CDR2_BE = 0x0006, D_CDR2_BE = 0x0008, PL_CDR2_BE = 0x000a). The default implementation delegates to Self::decode (little-endian) so pre-decode_be codegen keeps working on the canonical wire; idl-rust codegen overrides this to build a big-endian reader. Symmetric to Self::encode_be. Spec: zerodds-xcdr2-rust §2.4; RTPS 2.5 §10.5. Read more
Source§

fn encode_xcdr1(&self, out: &mut Vec<u8>) -> Result<(), EncodeError>

Serializes as classic CDR / XCDR1 little-endian (representation CDR_LE = 0x0001, max-alignment 8, no DHEADER on @final/@appendable, PL_CDR1 for @mutable). This is the encoding Cyclone DDS carries in an iceoryx PSMX chunk for a serialized sample, so the iceoryx-cyclone bridge uses it for cross-vendor same-host interop. The default delegates to Self::encode (XCDR2) — correct only for types whose XCDR1 and XCDR2 byte streams coincide (no 8-byte members, @final, no @mutable); idl-rust codegen overrides it with a true XCDR1 writer. Read more
Source§

fn decode_xcdr1(bytes: &[u8]) -> Result<Self, DecodeError>

Deserializes a classic-CDR / XCDR1 little-endian payload. Symmetric to Self::encode_xcdr1; the default delegates to Self::decode and idl-rust codegen overrides it with an XCDR1 reader. Read more
Source§

fn decode_xcdr1_be(bytes: &[u8]) -> Result<Self, DecodeError>

Deserializes a classic-CDR / XCDR1 big-endian payload (encapsulation CDR_BE = 0x0000 / PL_CDR_BE = 0x0002). The default delegates to Self::decode_xcdr1 (little-endian) — correct for byte-order-agnostic types and the common case (Cyclone/FastDDS/RTI emit XCDR1 little-endian); idl-rust codegen overrides it with a true big-endian XCDR1 reader. Symmetric to Self::decode_be for XCDR2. Read more
Source§

fn encode_key_holder_be(&self, _holder: &mut PlainCdr2BeKeyHolder)

Serializes the @key member values in PLAIN_CDR2-BE format into the given PlainCdr2BeKeyHolder. Order: ascending by member_id (XTypes 1.3 §7.6.8.3.1.b). Read more
Source§

fn field_value(&self, _path: &str) -> Option<Value>

Returns the value of a field path (dotted, e.g. "a.b") as a zerodds_sql_filter::Value for SQL filter evaluation in QueryCondition / ContentFilteredTopic. Default: None (no field reachable — the filter then denies every sample that contains a field access). Read more
Source§

fn compute_key_hash(&self) -> Option<[u8; 16]>

Computes the 16-byte KeyHash of this instance per XTypes 1.3 §7.6.8.4. None if HAS_KEY = false. Read more
Source§

fn key_hash(&self) -> Option<[u8; 16]>

Spec-aligned alias for Self::compute_key_hash. zerodds-xcdr2-rust §2.5 uses the name key_hash; the implementation name keeps compute_key_hash for historical compat. Both return the same value.
Source§

impl Debug for RawBytes

Source§

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

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

impl Eq for RawBytes

Source§

impl PartialEq for RawBytes

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for RawBytes

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 = 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.