Skip to main content

AsyncDataWriter

Struct AsyncDataWriter 

Source
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>

Source

pub async fn write(&self, sample: &T) -> Result<()>
where T: Clone,

Writes a sample. Spec §2.1.1.

§Errors

Same as DataWriter::writeOutOfResources 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.

Source

pub async fn register_instance(&self, sample: &T) -> Result<InstanceHandle>

Spec §2.1.2 register_instance.

§Errors

Same as sync.

Source

pub async fn dispose(&self, sample: &T, handle: InstanceHandle) -> Result<()>

Spec §2.1.3 dispose. Triggers the DISPOSED wire lifecycle.

§Errors

Same as sync.

Source

pub async fn unregister_instance( &self, sample: &T, handle: InstanceHandle, ) -> Result<()>

Spec §2.1.4 unregister_instance.

§Errors

Same as sync.

Source

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.

Source

pub fn matched_subscription_count(&self) -> usize

Spec §2.1.6 matched_subscription_count (synchronous).

Source

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

Returns the underlying sync variant.

Source

pub fn qos(&self) -> DataWriterQos

Returns the DataWriterQos.

Trait Implementations§

Source§

impl<T: DdsType + Send + Sync + 'static> Clone for AsyncDataWriter<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.