pub enum View<'sample, T>where
T: Topicable,{
Sample(&'sample T),
Key(&'sample T::Key),
}Expand description
A borrowed view into a SampleOrKey for pattern matching.
Obtained via SampleOrKey::view. Distinguishes between a full sample and
a key-only sample without consuming the SampleOrKey and without
implicitly materializing the other half.
§Examples
use cyclonedds::sample::View;
for sample in reader.read()? {
match sample.view() {
View::Sample(sample) => println!("got sample: {sample:?}"),
View::Key(key) => println!("got key-only: {key:?}"),
}
}Variants§
Sample(&'sample T)
A full data sample.
Key(&'sample T::Key)
A key-only notification, produced when an instance is disposed or unregistered.
Trait Implementations§
Auto Trait Implementations§
impl<'sample, T> Freeze for View<'sample, T>
impl<'sample, T> RefUnwindSafe for View<'sample, T>
impl<'sample, T> Send for View<'sample, T>
impl<'sample, T> Sync for View<'sample, T>
impl<'sample, T> Unpin for View<'sample, T>
impl<'sample, T> UnsafeUnpin for View<'sample, T>
impl<'sample, T> UnwindSafe for View<'sample, T>
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