Skip to main content

DomainParticipant

Struct DomainParticipant 

Source
pub struct DomainParticipant { /* private fields */ }
Expand description

A DDS domain participant (DDS 1.4, 2.2.2.2.1): the entry point that creates topics, publishers and subscribers in one domain.

It runs a thread for discovery (SPDP and SEDP) and for receiving data. Dropping the participant stops the thread; writers and readers made from it stop working then.

Implementations§

Source§

impl DomainParticipant

Source

pub fn new(domain_id: u32) -> Result<Self>

Joins a domain with the default settings.

Source

pub fn with_config(config: ParticipantConfig) -> Result<Self>

Joins a domain.

Source

pub fn domain_id(&self) -> u32

The domain id.

Source

pub fn guid(&self) -> Guid

The participant’s GUID.

Source

pub fn register_type<T: TopicType + DescribeType>(&self) -> Result<()>

Registers the type T with its DDS-XTypes description (register_type, DDS-XTypes 1.3, 7.6.3.2): the writers and readers of T created afterwards announce its TypeInformation, and are matched with remote endpoints by type assignability rather than by type name (see crate::DataReaderQos::type_consistency). rustorb-idl writes DescribeType with -Wbxtypes.

Registering a type again does nothing. Fails with Error::Unsupported for a type that has no TypeObjects (one that depends on itself).

Source

pub fn register_dynamic_type(&self, ty: &DynamicType) -> Result<()>

Registers a type known at run time (register_type with a DynamicType, DDS-XTypes 1.3, 7.6.3.2), under its name: as register_type does for a type the program was built with. Registering the same type again does nothing; a different type of a name already registered fails with Error::PreconditionNotMet.

Source

pub fn create_dynamic_topic( &self, name: &str, ty: &DynamicType, ) -> Result<Topic<DynamicData>>

Creates a topic named name of a type known at run time, whose samples are DynamicData: its writers and readers are a DynamicDataWriter and a DynamicDataReader (DDS-XTypes 1.3, 7.5.2.12). The type is registered as by register_dynamic_type, so that endpoints match by type assignability.

Source

pub fn discover_topic_type( &self, topic_name: &str, timeout: Duration, ) -> Result<Option<DynamicType>>

The type of the topic topic_name as the other participants know it, for a program that was not built with it: the type of a remote writer (or else reader) of the topic that announced its TypeInformation, made from its COMPLETE TypeObjects, which the participant asks the remote participant for with the TypeLookup service (DDS-XTypes 1.3, 7.6.3.3). None when no such endpoint was discovered, or its TypeObjects did not come, within timeout.

Then create_dynamic_topic makes a topic of it, whose readers read the samples of that writer.

Source

pub fn learnt_types(&self) -> usize

How many TypeObjects of remote types this participant got from other participants with the TypeLookup service (DDS-XTypes 1.3, 7.6.3.3). It asks for them when an endpoint announces a type whose TypeObject it does not have, to check assignability.

Source

pub fn create_topic<T: TopicType + 'static>( &self, name: &str, ) -> Result<Topic<T>>

Creates a topic of type T, named name.

Source

pub fn create_contentfilteredtopic<T>( &self, name: &str, related: &Topic<T>, filter_expression: &str, expression_parameters: &[String], ) -> Result<ContentFilteredTopic<T>>

Creates a content filtered topic named name (DDS 1.4, 2.2.2.2.1.7): its readers get the samples of related that pass the filter filter_expression (DDS 1.4, Annex B; see ContentFilter) with expression_parameters for its %n.

The filter reads the fields of the samples by their names in the type’s description, so the type must be registered: a dynamic topic’s is, and a TopicType needs register_type first, or this fails with Error::PreconditionNotMet. A filter expression that is not valid for the type fails with Error::Dynamic.

Source

pub fn create_publisher(&self) -> Result<Publisher>

Creates a publisher in the default partition.

Source

pub fn create_publisher_with_qos(&self, qos: PublisherQos) -> Result<Publisher>

Creates a publisher with the given QoS (its partitions).

Source

pub fn create_subscriber(&self) -> Result<Subscriber>

Creates a subscriber in the default partition.

Source

pub fn create_subscriber_with_qos( &self, qos: SubscriberQos, ) -> Result<Subscriber>

Creates a subscriber with the given QoS (its partitions).

Source

pub fn set_listener( &self, listener: impl DomainParticipantListener + 'static, mask: StatusMask, )

Sets the participant’s listener (set_listener, DDS 1.4, 2.2.2.1.1), replacing any earlier one: it is called for the statuses in mask of its entities that their own listeners, and those of their publishers, subscribers or topics, do not take (2.2.4.3.1). See DomainParticipantListener.

Source

pub fn clear_listener(&self)

Removes the participant’s listener.

Source

pub fn assert_liveliness(&self) -> Result<()>

Asserts the liveliness of the participant’s MANUAL_BY_PARTICIPANT writers (assert_liveliness, DDS 1.4, 2.2.2.2.1.19). Writing with any of them does too.

Source

pub fn discovered_participants(&self) -> Vec<GuidPrefix>

The GUID prefixes of the other participants discovered.

Trait Implementations§

Source§

impl Debug for DomainParticipant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for DomainParticipant

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.