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>
impl<T: DdsType + Send + Sync + 'static> AsyncDataReader<T>
Sourcepub fn take_stream(&self) -> SampleStream<T>
pub fn take_stream(&self) -> SampleStream<T>
Spec §2.2.1 take_stream — Stream<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).
Sourcepub async fn take(&self, timeout: Duration) -> Result<Vec<T>>
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.
Sourcepub async fn wait_for_matched_publication(
&self,
min_count: usize,
timeout: Duration,
) -> Result<()>
pub async fn wait_for_matched_publication( &self, min_count: usize, timeout: Duration, ) -> Result<()>
Sourcepub fn matched_publication_count(&self) -> usize
pub fn matched_publication_count(&self) -> usize
Spec §2.2.4 matched_publication_count (synchronous).
Sourcepub fn as_sync(&self) -> &DataReader<T>
pub fn as_sync(&self) -> &DataReader<T>
Returns the underlying sync variant.
Sourcepub fn qos(&self) -> DataReaderQos
pub fn qos(&self) -> DataReaderQos
Returns the DataReaderQos.
Sourcepub fn data_available_stream(&self) -> DataAvailableStream<T>
pub fn data_available_stream(&self) -> DataAvailableStream<T>
Spec §6.1 data_available_stream — Stream<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.
Sourcepub fn publication_matched_stream(&self) -> PublicationMatchedStream<T>
pub fn publication_matched_stream(&self) -> PublicationMatchedStream<T>
Spec §6.2 publication_matched_stream —
Stream<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.