Skip to main content

SampleInfo

Struct SampleInfo 

Source
pub struct SampleInfo {
    pub sample_state: SampleStateKind,
    pub view_state: ViewStateKind,
    pub instance_state: InstanceStateKind,
    pub disposed_generation_count: i32,
    pub no_writers_generation_count: i32,
    pub sample_rank: i32,
    pub generation_rank: i32,
    pub absolute_generation_rank: i32,
    pub source_timestamp: Time,
    pub instance_handle: InstanceHandle,
    pub publication_handle: InstanceHandle,
    pub valid_data: bool,
}
Expand description

SampleInfo (DDS 1.4 §2.2.2.5.1) — per-sample metadata.

Filled by the DataReader in the take/read path. Application code is meant to rely on these fields to:

  • distinguish new samples from re-read ones (sample_state),
  • detect new instances (view_state == NEW),
  • observe lifecycle events (instance_state, valid_data == false),
  • follow reordering / generation changes (*_generation_count, *_rank).

Fields§

§sample_state: SampleStateKind

Sample-State (READ / NOT_READ).

§view_state: ViewStateKind

View-State (NEW / NOT_NEW).

§instance_state: InstanceStateKind

Instance-State (ALIVE / NOT_ALIVE_*).

§disposed_generation_count: i32

How many times the instance has gone through NOT_ALIVE_DISPOSED → ALIVE since its first sample.

§no_writers_generation_count: i32

How many times the instance has gone through NOT_ALIVE_NO_WRITERS → ALIVE since its first sample.

§sample_rank: i32

Number of samples in the same instance that follow this one in the cache (§2.2.2.5.1.5).

§generation_rank: i32

Difference in generation_count between this sample and the last sample of the instance in the same read set.

§absolute_generation_rank: i32

Difference in generation_count between this sample and the current generation count.

§source_timestamp: Time

Wall-clock time of the write/dispose/unregister.

§instance_handle: InstanceHandle

Local handle of the instance.

§publication_handle: InstanceHandle

Local handle of the sending DataWriter (HANDLE_NIL in the offline / unknown case).

§valid_data: bool

true if the sample carries payload; false for a plain dispose/unregister marker (§2.2.2.5.1.13).

Implementations§

Source§

impl SampleInfo

Source

pub fn new_alive( instance: InstanceHandle, publication: InstanceHandle, timestamp: Time, ) -> Self

Constructs a default info block for a fresh sample of a new instance with valid_data = true.

Source

pub fn matches_states( &self, sample_mask: u32, view_mask: u32, instance_mask: u32, ) -> bool

Checks whether this SampleInfo is accepted by the given state masks (spec §2.2.2.5.3.1, read_w_condition).

Trait Implementations§

Source§

impl Clone for SampleInfo

Source§

fn clone(&self) -> SampleInfo

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 Copy for SampleInfo

Source§

impl Debug for SampleInfo

Source§

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

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

impl Default for SampleInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for SampleInfo

Source§

impl PartialEq for SampleInfo

Source§

fn eq(&self, other: &SampleInfo) -> 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 SampleInfo

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.