pub struct Participant<'domain> { /* private fields */ }Expand description
A domain participant.
A participant is the entry point for all DDS communication within a
Domain. All other entities, including topics, readers,
writers, publishers, and subscribers, are created under a participant and
are scoped to its lifetime.
Use Participant::new for simple construction or Participant::builder
for QoS and listener
configuration.
Implementations§
Source§impl<'d> Participant<'d>
impl<'d> Participant<'d>
Sourcepub const fn builder<'q>(domain: &'d Domain) -> ParticipantBuilder<'d, 'q>
pub const fn builder<'q>(domain: &'d Domain) -> ParticipantBuilder<'d, 'q>
Returns a ParticipantBuilder for constructing a participant with
custom QoS or a listener.
§Examples
use cyclonedds::{Domain, Participant};
let domain = Domain::default();
let participant = Participant::builder(&domain).build()?;Sourcepub fn set_listener<L>(&mut self, listener: L) -> Result<()>
pub fn set_listener<L>(&mut self, listener: L) -> Result<()>
Sets the Listener on this participant, replacing
any previously set listener.
§Errors
Returns an Error if the listener fails to set.
§Examples
use cyclonedds::{Domain, Listener, Participant, listener::SubscriberListener};
let domain = Domain::default();
let mut participant = Participant::new(&domain)?;
let listener =
Listener::new().with_subscriber(|s| s.with_data_on_readers(|_| println!("data available")));
participant.set_listener(listener)?;Sourcepub fn unset_listener(&mut self) -> Result<()>
pub fn unset_listener(&mut self) -> Result<()>
Sourcepub fn with_listener<L>(self, listener: L) -> Result<Self>
pub fn with_listener<L>(self, listener: L) -> Result<Self>
Sets the Listener on this participant, consuming
and returning self.
Useful for chaining participant construction with listener configuration.
§Errors
Returns an Error if the listener fails to set.
§Examples
use cyclonedds::{Domain, Listener, Participant};
let domain = Domain::default();
let participant = Participant::new(&domain)?.with_listener(Listener::new())?;Trait Implementations§
Source§impl<'domain> Debug for Participant<'domain>
impl<'domain> Debug for Participant<'domain>
Source§impl Drop for Participant<'_>
impl Drop for Participant<'_>
Source§impl Entity for Participant<'_>
impl Entity for Participant<'_>
Source§fn instance_handle(&self) -> Result<InstanceHandle>
fn instance_handle(&self) -> Result<InstanceHandle>
Returns the
InstanceHandle of this entity. Read moreSource§fn status_changes(&self) -> Result<Status>
fn status_changes(&self) -> Result<Status>
Auto Trait Implementations§
impl<'domain> Freeze for Participant<'domain>
impl<'domain> RefUnwindSafe for Participant<'domain>
impl<'domain> Send for Participant<'domain>
impl<'domain> Sync for Participant<'domain>
impl<'domain> Unpin for Participant<'domain>
impl<'domain> UnsafeUnpin for Participant<'domain>
impl<'domain> UnwindSafe for Participant<'domain>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more