Skip to main content

RawBytes

Struct RawBytes 

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

Ein opaker Raw-Byte-Payload mit konfigurierbarem Type-Name (per impl von BytesPayload<T> oder via newtype).

Fields§

§data: Vec<u8>

Payload-Bytes (werden 1:1 auf die Wire gelegt, kein CDR-Framing).

Implementations§

Source§

impl RawBytes

Source

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

Konstruktor.

Examples found in repository?
examples/hello_dds_publisher.rs (line 56)
38fn main() -> Result<(), Box<dyn std::error::Error>> {
39    let factory = DomainParticipantFactory::instance();
40    let participant = factory.create_participant(0, DomainParticipantQos::default())?;
41
42    let topic = participant.create_topic::<RawBytes>("Chatter", TopicQos::default())?;
43    let publisher = participant.create_publisher(PublisherQos::default());
44    let writer = publisher.create_datawriter::<RawBytes>(&topic, DataWriterQos::default())?;
45
46    println!("hello_dds_publisher: sending on Domain 0 Topic 'Chatter' — Ctrl-C to stop");
47
48    // Ein paar Sekunden warten, damit SPDP+SEDP Subscriber entdecken kann.
49    // Ohne Warte-Phase gehen die ersten Samples ins Leere (noch kein Reader
50    // gematched). v1.3 bringt `wait_for_matched_subscription`.
51    thread::sleep(Duration::from_secs(3));
52
53    let mut counter: u32 = 0;
54    loop {
55        let payload = format!("hello #{counter}");
56        writer.write(&RawBytes::new(payload.clone().into_bytes()))?;
57        println!("  -> {payload}");
58        counter = counter.wrapping_add(1);
59        thread::sleep(Duration::from_secs(1));
60    }
61}

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"

Vollqualifizierter Topic-Type-Name (z.B. "std_msgs::String"). Muss exakt zum Peer-Type-Namen passen (strict matching).
Source§

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

Serialisiert self in den XCDR2-Payload, der in einer DATA-Submessage als serialized_payload gesendet wird. Default-Endianness: Little-Endian (RTPS 2.5 §10.5 RepresentationIdentifier = CDR2_LE = 0x0010). Read more
Source§

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

Deserialisiert einen XCDR2-Payload. Der Caller stellt sicher, dass bytes den vollen Sample-Payload enthaelt. Read more
Source§

const EXTENSIBILITY: Extensibility = Extensibility::Final

XTypes 1.3 §7.4.5 Struct-Extensibility-Kind. Default Final fuer Backwards-Kompat zu pre-EXTENSIBILITY-Codegen-Outputs. Spec: zerodds-xcdr2-rust §2.3.
Source§

const HAS_KEY: bool = false

true wenn der Topic-Type keyed ist (mindestens ein Member mit @key-Annotation). Default false — Caller (proc-macro) ueberschreibt fuer keyed Types und implementiert auch Self::encode_key_holder_be. Read more
Source§

const IS_KEYED: bool = Self::HAS_KEY

Spec-aligned Alias fuer Self::HAS_KEY. zerodds-xcdr2-rust §2 referenziert das als IS_KEYED.
Source§

const KEY_HOLDER_MAX_SIZE: Option<usize> = None

Maximale Groesse des PLAIN_CDR2-BE-KeyHolder-Streams in Bytes (XTypes 1.3 §7.6.8.4 Step 5). None = nicht keyed oder unbounded (MD5-Pfad). Some(n) mit n <= 16 = zero-pad-Pfad.
Source§

const IS_NESTED: bool = false

true wenn der Type mit @nested annotiert ist (XTypes 1.3 §7.4.6.3.5). Nested-Types sind nur als Member anderer Types gedacht und MUESSEN nicht als DDS-Topic-Type registriert werden. DomainParticipant::create_topic lehnt registration von nested-Types mit PreconditionNotMet ab.
Source§

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

XTypes 1.3 §7.3.4.2 — TypeIdentifier des Types fuer XTypes-aware Discovery + Compatibility-Matching. Default TypeIdentifier::None signalisiert “type-id nicht bereitgestellt; Reader-Writer-Match faellt zurueck auf reinen type_name-Vergleich (DDS 1.4 §2.2.3 Default-Path)”. Read more
Source§

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

Big-Endian-Variante von Self::encode. Default-Implementation delegiert auf Self::encode (kein Byte-Swap), da generischer BE-Re-Encode ohne Type-Reflection nicht moeglich ist. Codegen ueberschreibt das fuer Strukturen, die echt BE auf die Wire gehen sollen. Spec: zerodds-xcdr2-rust §2.4. Read more
Source§

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

Serialisiert die @key-Member-Werte im PLAIN_CDR2-BE-Format in den uebergebenen PlainCdr2BeKeyHolder. Reihenfolge: nach member_id aufsteigend (XTypes 1.3 §7.6.8.3.1.b). Read more
Source§

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

Liefert den Wert eines Feldpfads (dotted, z.B. "a.b") als zerodds_sql_filter::Value fuer SQL-Filter-Evaluation in QueryCondition / ContentFilteredTopic. Default: None (kein Feld erreichbar — der Filter denied dann jedes Sample, sofern es einen Feldzugriff enthaelt). Read more
Source§

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

Berechnet den 16-Byte KeyHash dieser Instanz nach XTypes 1.3 §7.6.8.4. None wenn HAS_KEY = false. Read more
Source§

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

Spec-aligned Alias fuer Self::compute_key_hash. zerodds-xcdr2-rust §2.5 nutzt den Namen key_hash; der Implementations-Name behaelt compute_key_hash aus historischer Kompat. Beide liefern denselben Wert.
Source§

impl Debug for RawBytes

Source§

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

Formats the value using the given formatter. Read more
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 Eq for RawBytes

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.