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)
meansvalid_data == true
and there is a sampled
.Sample::Dispose(k)
meansvalid_data == false
, no sample exists, but only a Keyk
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,
impl<D> DataSample<D>where
D: Keyed,
pub fn key(&self) -> D::K
pub fn value(&self) -> &Sample<D, D::K>
pub fn into_value(self) -> Sample<D, D::K>
pub fn sample_info(&self) -> &SampleInfo
pub fn sample_info_mut(&mut self) -> &mut SampleInfo
Trait Implementations§
impl<D: Keyed> StructuralPartialEq for DataSample<D>
Auto Trait Implementations§
impl<D> Freeze for DataSample<D>
impl<D> RefUnwindSafe for DataSample<D>
impl<D> Send for DataSample<D>
impl<D> Sync for DataSample<D>
impl<D> Unpin for DataSample<D>
impl<D> UnwindSafe for DataSample<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more