Skip to main content

TopicBuilder

Struct TopicBuilder 

Source
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,

Source

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");
Source

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);
Source

pub fn with_listener<L>(self, listener: L) -> Self
where L: AsRef<TopicListener<T>>,

Sets the Listener on this topic builder.

§Examples
use cyclonedds::TopicListener;
use cyclonedds::builder::TopicBuilder;

let participant_builder =
    TopicBuilder::<Data>::new(&participant, "MyTopic").with_listener(TopicListener::new());
Source

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§

Source§

impl<'domain, 'participant, 'qos, 'name, T> Debug for TopicBuilder<'domain, 'participant, 'qos, 'name, T>
where T: Topicable + Debug,

Source§

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

Formats the value using the given formatter. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.