Struct DataSample

Source
pub struct DataSample<D: Keyed> { /* private fields */ }
Expand description

A data sample and its associated metadata received from a WITH_KEY Topic.

Note that no_key::DataSample and with_key::DataSample are two different structs.

We are using Sample to replace the valid_data flag from the DDS spec, because when valid_data = false, the application should not be able to access any data.

Sample usage:

  • Sample::Value(d) means valid_data == true and there is a sample d.
  • Sample::Dispose(k) means valid_data == false, no sample exists, but only a Key k and instance_state has changed.

See also DDS spec v1.4 Section 2.2.2.5.4.

Implementations§

Source§

impl<D> DataSample<D>
where D: Keyed,

Source

pub fn key(&self) -> D::K

Source

pub fn value(&self) -> &Sample<D, D::K>

Source

pub fn into_value(self) -> Sample<D, D::K>

Source

pub fn sample_info(&self) -> &SampleInfo

Source

pub fn sample_info_mut(&mut self) -> &mut SampleInfo

Trait Implementations§

Source§

impl<D: Debug + Keyed> Debug for DataSample<D>
where D::K: Debug,

Source§

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

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

impl<D: PartialEq + Keyed> PartialEq for DataSample<D>
where D::K: PartialEq,

Source§

fn eq(&self, other: &DataSample<D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<D: Keyed> StructuralPartialEq for DataSample<D>

Auto Trait Implementations§

§

impl<D> Freeze for DataSample<D>
where D: Freeze, <D as Keyed>::K: Freeze,

§

impl<D> RefUnwindSafe for DataSample<D>
where D: RefUnwindSafe, <D as Keyed>::K: RefUnwindSafe,

§

impl<D> Send for DataSample<D>
where D: Send, <D as Keyed>::K: Send,

§

impl<D> Sync for DataSample<D>
where D: Sync, <D as Keyed>::K: Sync,

§

impl<D> Unpin for DataSample<D>
where D: Unpin, <D as Keyed>::K: Unpin,

§

impl<D> UnwindSafe for DataSample<D>
where D: UnwindSafe, <D as Keyed>::K: UnwindSafe,

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> 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V