pub struct TopicBuilder<'domain, 'participant, 'qos, 'name, T>where
T: Topicable,{ /* private fields */ }Expand description
Builder for Topic<T> (accessible via Topic::builder).
Implementations§
Source§impl<'d, 'p, 'q, 'n, T> TopicBuilder<'d, 'p, 'q, 'n, T>where
T: Topicable,
impl<'d, 'p, 'q, 'n, T> TopicBuilder<'d, 'p, 'q, 'n, T>where
T: Topicable,
Sourcepub const fn new(participant: &'p Participant<'d>, topic_name: &'n str) -> Self
pub const fn new(participant: &'p Participant<'d>, topic_name: &'n str) -> Self
Creates a new TopicBuilder for the given Participant.
§Examples
use cyclonedds::builder::TopicBuilder;
use cyclonedds::{Domain, Participant};
let domain = Domain::default();
let participant = Participant::new(&domain)?;
let topic_builder = TopicBuilder::<Data>::new(&participant, "MyTopic");Sourcepub const fn with_qos(self, qos: &'q QoS) -> Self
pub const fn with_qos(self, qos: &'q QoS) -> Self
Sets the QoS for this topic builder.
§Examples
use cyclonedds::builder::TopicBuilder;
use cyclonedds::qos::policy;
use cyclonedds::{Duration, QoS};
let qos = QoS::new().with_reliability(policy::Reliability::Reliable {
max_blocking_time: Duration::from_millis(100),
});
let topic_builder = TopicBuilder::<Data>::new(&participant, "MyTopic").with_qos(&qos);Sourcepub fn with_listener<L>(self, listener: L) -> Selfwhere
L: AsRef<TopicListener<T>>,
pub fn with_listener<L>(self, listener: L) -> Selfwhere
L: AsRef<TopicListener<T>>,
Sourcepub fn build(self) -> Result<Topic<'d, 'p, T>>
pub fn build(self) -> Result<Topic<'d, 'p, T>>
Builds the Topic.
§Errors
Returns an Error if the topic failed to create.
§Examples
use cyclonedds::QoS;
use cyclonedds::builder::TopicBuilder;
use cyclonedds::qos::policy;
let qos = QoS::new().with_durability(policy::Durability::TransientLocal);
let topic = TopicBuilder::<Data>::new(&participant, "MyTopic")
.with_qos(&qos)
.build()?;Trait Implementations§
Auto Trait Implementations§
impl<'domain, 'participant, 'qos, 'name, T> !Send for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
impl<'domain, 'participant, 'qos, 'name, T> !Sync for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
impl<'domain, 'participant, 'qos, 'name, T> Freeze for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
impl<'domain, 'participant, 'qos, 'name, T> RefUnwindSafe for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
impl<'domain, 'participant, 'qos, 'name, T> Unpin for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
impl<'domain, 'participant, 'qos, 'name, T> UnsafeUnpin for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
impl<'domain, 'participant, 'qos, 'name, T> UnwindSafe for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
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