pub enum Sample<D, K> {
Value(D),
Dispose(K),
}Expand description
A data sample received from a WITH_KEY Topic without the associated metadata.
Replaces the use of valid_data flag in SampleInfo of DataSample from the
DDS spec.
Implements the methods value, map_value, map_dispose, and
as_ref. The unwrap method is deprecated — use value() or match on
Sample::Value / Sample::Dispose instead.
Variants§
Implementations§
Source§impl<D, K> Sample<D, K>
impl<D, K> Sample<D, K>
pub fn value(self) -> Option<D>
pub fn map_value<D2, F: FnOnce(D) -> D2>(self, op: F) -> Sample<D2, K>
pub fn map_dispose<K2, F: FnOnce(K) -> K2>(self, op: F) -> Sample<D, K2>
Sourcepub fn unwrap(self) -> D
👎Deprecated: panics on Sample::Dispose; use value() or match on Sample::Value/Dispose
pub fn unwrap(self) -> D
panics on Sample::Dispose; use value() or match on Sample::Value/Dispose
Returns the data sample, panicking if this is a dispose notification.
§Panics
Panics if called on Sample::Dispose. Use Self::value or match on
Sample::Value / Sample::Dispose.
pub const fn as_ref(&self) -> Sample<&D, &K>
Trait Implementations§
impl<D: PartialEq, K: PartialEq> StructuralPartialEq for Sample<D, K>
Auto Trait Implementations§
impl<D, K> Freeze for Sample<D, K>
impl<D, K> RefUnwindSafe for Sample<D, K>where
D: RefUnwindSafe,
K: RefUnwindSafe,
impl<D, K> Send for Sample<D, K>
impl<D, K> Sync for Sample<D, K>
impl<D, K> Unpin for Sample<D, K>
impl<D, K> UnsafeUnpin for Sample<D, K>where
D: UnsafeUnpin,
K: UnsafeUnpin,
impl<D, K> UnwindSafe for Sample<D, K>where
D: UnwindSafe,
K: UnwindSafe,
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