Struct rustdds::dds::DomainParticipant
source · [−]pub struct DomainParticipant { /* private fields */ }
Expand description
DDS DomainParticipant
It is recommended that only one DomainParticipant per OS process is created, as it allocates network sockets, creates background threads, and allocates some memory for object caches.
If you need to communicate to many DDS domains,
then you must create a separate DomainParticipant for each of them.
See DDS Spec v1.4 Section “2.2.1.2.2 Overall Conceptual Model” and
“2.2.2.2.1 DomainParticipant Class” for a definition of a (DDS) domain.
Domains are identified by a domain identifier, which is, in Rust terms, a
u16
. Domain identifier values are application-specific, but 0
is usually
the default.
Implementations
sourceimpl DomainParticipant
impl DomainParticipant
sourcepub fn new(domain_id: u16) -> Result<DomainParticipant>
pub fn new(domain_id: u16) -> Result<DomainParticipant>
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
sourcepub fn create_publisher(&self, qos: &QosPolicies) -> Result<Publisher>
pub fn create_publisher(&self, qos: &QosPolicies) -> Result<Publisher>
Creates DDS Publisher
Arguments
qos
- Takes qos policies for publisher and given to DataWriter as default.
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
let qos = QosPolicyBuilder::new().build();
let publisher = domain_participant.create_publisher(&qos);
sourcepub fn create_subscriber(&self, qos: &QosPolicies) -> Result<Subscriber>
pub fn create_subscriber(&self, qos: &QosPolicies) -> Result<Subscriber>
Creates DDS Subscriber
Arguments
qos
- Takes qos policies for subscriber and given to DataReader as default.
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
let qos = QosPolicyBuilder::new().build();
let subscriber = domain_participant.create_subscriber(&qos);
sourcepub fn create_topic(
&self,
name: String,
type_desc: String,
qos: &QosPolicies,
topic_kind: TopicKind
) -> Result<Topic>
pub fn create_topic(
&self,
name: String,
type_desc: String,
qos: &QosPolicies,
topic_kind: TopicKind
) -> Result<Topic>
Create DDS Topic
Arguments
name
- Name of the topic.type_desc
- Name of the type this topic is supposed to deliver.qos
- Takes qos policies that are distributed to DataReaders and DataWriters.
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
let qos = QosPolicyBuilder::new().build();
let topic = domain_participant.create_topic("some_topic".to_string(), "SomeType".to_string(), &qos, TopicKind::WithKey);
pub fn find_topic(&self, name: &str, timeout: Duration) -> Result<Option<Topic>>
sourcepub fn domain_id(&self) -> u16
pub fn domain_id(&self) -> u16
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
let domain_id = domain_participant.domain_id();
sourcepub fn participant_id(&self) -> u16
pub fn participant_id(&self) -> u16
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
let participant_id = domain_participant.participant_id();
sourcepub fn discovered_topics(&self) -> Vec<DiscoveredTopicData>
pub fn discovered_topics(&self) -> Vec<DiscoveredTopicData>
Gets all DiscoveredTopics from DDS network
Examples
let domain_participant = DomainParticipant::new(0).unwrap();
let discovered_topics = domain_participant.discovered_topics();
for dtopic in discovered_topics.iter() {
// do something
}
sourcepub fn assert_liveliness(self) -> Result<()>
pub fn assert_liveliness(self) -> Result<()>
Manually asserts liveliness, affecting all writers with LIVELINESS QoS of MANUAL_BY_PARTICIPANT created by this particular participant.
Example
let domain_participant = DomainParticipant::new(0).expect("Failed to create participant");
domain_participant.assert_liveliness();
Trait Implementations
sourceimpl Clone for DomainParticipant
impl Clone for DomainParticipant
sourcefn clone(&self) -> DomainParticipant
fn clone(&self) -> DomainParticipant
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DomainParticipant
impl Debug for DomainParticipant
sourceimpl RTPSEntity for DomainParticipant
impl RTPSEntity for DomainParticipant
Auto Trait Implementations
impl RefUnwindSafe for DomainParticipant
impl Send for DomainParticipant
impl Sync for DomainParticipant
impl Unpin for DomainParticipant
impl UnwindSafe for DomainParticipant
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more