pub struct AsyncDataWriter<T: DdsType + Send + Sync + 'static> { /* private fields */ }Expand description
Async wrapper around DataWriter<T>.
Hot path: write() is a future form over the sync path with
a yield-based retry loop for
OutOfResources backpressure (Spec §5.1
zerodds-async-1.0). Instead of a thread-blocking Condvar::wait_timeout,
caller tasks yield out of the executor via yield_for and stay
cancelable. Other DCPS methods delegate synchronously — they are
non-blocking anyway.
Implementations§
Source§impl<T: DdsType + Send + Sync + 'static> AsyncDataWriter<T>
impl<T: DdsType + Send + Sync + 'static> AsyncDataWriter<T>
Sourcepub async fn write(&self, sample: &T) -> Result<()>where
T: Clone,
pub async fn write(&self, sample: &T) -> Result<()>where
T: Clone,
Writes a sample. Spec §2.1.1.
§Errors
Same as DataWriter::write — OutOfResources after the
max_blocking_time timeout, otherwise all other errors are
passed through transparently.
Spec §5.1 zerodds-async-1.0: on OutOfResources the future
suspends via yield_for and retries until either a drain
happens or reliability.max_blocking_time has elapsed.
In the sync path a Condvar::wait_timeout would block here —
the async path uses a yield-retry loop without a
thread block.
Sourcepub async fn register_instance(&self, sample: &T) -> Result<InstanceHandle>
pub async fn register_instance(&self, sample: &T) -> Result<InstanceHandle>
Sourcepub async fn unregister_instance(
&self,
sample: &T,
handle: InstanceHandle,
) -> Result<()>
pub async fn unregister_instance( &self, sample: &T, handle: InstanceHandle, ) -> Result<()>
Sourcepub async fn wait_for_matched_subscription(
&self,
min_count: usize,
timeout: Duration,
) -> Result<()>
pub async fn wait_for_matched_subscription( &self, min_count: usize, timeout: Duration, ) -> Result<()>
Spec §2.1.5 wait_for_matched_subscription. Async polling loop with a 10 ms tick.
§Errors
Same as sync — Timeout if min_count is not reached within timeout.
Sourcepub fn matched_subscription_count(&self) -> usize
pub fn matched_subscription_count(&self) -> usize
Spec §2.1.6 matched_subscription_count (synchronous).
Sourcepub fn as_sync(&self) -> &DataWriter<T>
pub fn as_sync(&self) -> &DataWriter<T>
Returns the underlying sync variant.
Sourcepub fn qos(&self) -> DataWriterQos
pub fn qos(&self) -> DataWriterQos
Returns the DataWriterQos.