zerodds_dcps_async/
participant.rs1use zerodds_dcps::{
6 DdsType, DomainParticipant, PublisherQos, Result, SubscriberQos, Topic, TopicQos,
7};
8
9use crate::{AsyncPublisher, AsyncSubscriber};
10
11#[derive(Clone)]
15pub struct AsyncDomainParticipant {
16 inner: DomainParticipant,
17}
18
19impl AsyncDomainParticipant {
20 pub(crate) fn from_sync(inner: DomainParticipant) -> Self {
21 Self { inner }
22 }
23
24 #[must_use]
26 pub fn domain_id(&self) -> i32 {
27 self.inner.domain_id()
28 }
29
30 pub fn create_topic<T: DdsType>(&self, name: &str, qos: TopicQos) -> Result<Topic<T>> {
35 self.inner.create_topic::<T>(name, qos)
36 }
37
38 #[must_use]
40 pub fn create_publisher(&self, qos: PublisherQos) -> AsyncPublisher {
41 AsyncPublisher::from_sync(self.inner.create_publisher(qos))
42 }
43
44 #[must_use]
46 pub fn create_subscriber(&self, qos: SubscriberQos) -> AsyncSubscriber {
47 AsyncSubscriber::from_sync(self.inner.create_subscriber(qos))
48 }
49
50 #[must_use]
52 pub fn as_sync(&self) -> &DomainParticipant {
53 &self.inner
54 }
55}