Skip to main content

UserSample

Enum UserSample 

Source
pub enum UserSample {
    Alive {
        payload: SampleBytes,
        writer_guid: [u8; 16],
        writer_strength: i32,
        representation: u8,
        big_endian: bool,
        source_timestamp: Option<HeTimestamp>,
    },
    Lifecycle {
        key_hash: [u8; 16],
        kind: ChangeKind,
    },
}
Expand description

Sample channel item: either data payload or lifecycle marker. Lifecycle is reconstructed by the wire path as key_hash + ChangeKind from the PID_STATUS_INFO header; the DataReader DCPS layer translates that into __push_lifecycle.

Variants§

§

Alive

Normal sample with payload (CDR-encoded application type). writer_guid is the 16-byte GUID of the emitting writer — needed by the subscriber for exclusive-ownership resolution (DDS 1.4 §2.2.3.23 / §2.2.2.5.5).

Fields

§payload: SampleBytes

CDR payload (without encapsulation header). Zero-copy container: typically holds an Arc<[u8]> slice into the RTPS wire datagram without a heap re-alloc. See docs/specs/zerodds-zero-copy-1.0.md.

§writer_guid: [u8; 16]

Writer GUID — for strongest-writer selection.

§writer_strength: i32

Writer ownership_strength at the time of receipt. 0 if the writer is not yet known via discovery (the reader treats this as default strength = spec-conformant for shared-ownership topics; for exclusive the reader filters the real strength against the current owner).

§representation: u8

XCDR version of the payload — extracted from the encapsulation header of the wire sample (RTPS 2.5 §10.5) BEFORE the header was stripped: 0 = XCDR1 (CDR/PL_CDR), 1 = XCDR2 (CDR2/D_CDR2/PL_CDR2). The typed consumer needs this to decode the body with the correct alignment rule (XTypes 1.3 §7.4.3.4.2).

§big_endian: bool

Byte order of the payload — extracted from the encapsulation representation identifier’s low bit (RTPS 2.5 §10.5: the _BE variants 0x0000/0x0002/0x0006/0x0008/0x000a are even, the _LE variants odd). false = little-endian (the canonical wire and the intra-runtime default), true = big-endian. The typed consumer dispatches DdsType::decode vs decode_be on this.

§source_timestamp: Option<HeTimestamp>

Source timestamp from the writer’s INFO_TS submessage (DDSI-RTPS §8.7.3), if any. Threaded into SampleInfo.source_timestamp and the DESTINATION_ORDER = BY_SOURCE_TIMESTAMP decision. None ⇒ the reader uses reception order.

§

Lifecycle

Lifecycle marker (dispose / unregister) — the reader sets InstanceState accordingly.

Fields

§key_hash: [u8; 16]

Key hash of the affected instance (16 byte).

§kind: ChangeKind

NotAliveDisposed / NotAliveUnregistered / NotAliveDisposedUnregistered.

Trait Implementations§

Source§

impl Clone for UserSample

Source§

fn clone(&self) -> UserSample

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 Debug for UserSample

Source§

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

Formats the value using the given formatter. Read more

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.