Skip to main content

AsyncDataReader

Struct AsyncDataReader 

Source
pub struct AsyncDataReader<T: DdsType + Send + Sync + 'static> { /* private fields */ }
Expand description

Async wrapper around DataReader<T>.

Implementations§

Source§

impl<T: DdsType + Send + Sync + 'static> AsyncDataReader<T>

Source

pub fn take_stream(&self) -> SampleStream<T>

Spec §2.2.1 take_streamStream<Item = T>.

Live mode (the reader has a runtime_handle()): the stream registers itself with register_user_reader_waker on the runtime; cx.waker() is fired on the next sample arrival (no polling). Offline mode: detached-thread sleep as a polling fallback (Spec §3.3).

Source

pub async fn take(&self, timeout: Duration) -> Result<Vec<T>>

Spec §2.2.2 take(timeout). Resolves to Ok with a Vec<T> when samples are available or the timeout has elapsed (in which case an empty Vec rather than Err — same as sync take()).

§Errors

Wire/decode errors, same as sync.

Source

pub async fn wait_for_matched_publication( &self, min_count: usize, timeout: Duration, ) -> Result<()>

Spec §2.2.3 wait_for_matched_publication.

§Errors

Timeout if min_count is not reached.

Source

pub fn matched_publication_count(&self) -> usize

Spec §2.2.4 matched_publication_count (synchronous).

Source

pub fn as_sync(&self) -> &DataReader<T>

Returns the underlying sync variant.

Source

pub fn qos(&self) -> DataReaderQos

Returns the DataReaderQos.

Source

pub fn data_available_stream(&self) -> DataAvailableStream<T>

Spec §6.1 data_available_streamStream<Item = ()>. Emits a () event per sample arrival; the caller then calls take() / iterates over take_stream() to fetch the samples. Does not consume samples (in contrast to Self::take_stream).

Live mode: registers itself on the runtime’s reader slot (register_user_reader_waker) — the wake happens on sample_tx.send by the runtime, no polling. Offline mode: detached-thread sleep as a polling fallback.

Source

pub fn publication_matched_stream(&self) -> PublicationMatchedStream<T>

Spec §6.2 publication_matched_streamStream<Item = SubscriptionMatchedStatus>. Emits the full reader-side match status (DDS 1.4 §2.2.4.1 SUBSCRIPTION_MATCHED) every time the count of matched publications (writers) changes. Fields: total_count (cumulative), total_count_change (delta), current_count (currently matched), current_count_change (signed delta), last_publication_handle.

Trait Implementations§

Source§

impl<T: DdsType + Send + Sync + 'static> Clone for AsyncDataReader<T>

Source§

fn clone(&self) -> Self

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

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.