Skip to main content

WriterBuilder

Struct WriterBuilder 

Source
pub struct WriterBuilder<'domain, 'participant, 'topic, 'qos, T>
where T: Topicable,
{ /* private fields */ }
Expand description

Builder for Writer<T> (accessible via Writer::builder).

Implementations§

Source§

impl<'d, 'p, 't, 'q, T> WriterBuilder<'d, 'p, 't, 'q, T>
where T: Topicable,

Source

pub const fn new(topic: &'t Topic<'d, 'p, T>) -> Self

Creates a new WriterBuilder for the given Topic.

§Examples
use cyclonedds::builder::WriterBuilder;
use cyclonedds::{Domain, Participant, Topic};

let domain = Domain::default();
let participant = Participant::new(&domain)?;
let topic = Topic::new(&participant, "MyTopic")?;
let writer_builder = WriterBuilder::<Data>::new(&topic);
Source

pub const fn with_qos(self, qos: &'q QoS) -> Self

Sets the QoS for this writer builder.

§Examples
use cyclonedds::builder::WriterBuilder;
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 writer_builder = WriterBuilder::<Data>::new(&topic).with_qos(&qos);
Source

pub const fn with_publisher(self, publisher: &'p Publisher<'d, 'p>) -> Self

Sets the Publisher on this writer builder.

§Examples
use cyclonedds::Publisher;
use cyclonedds::WriterListener;
use cyclonedds::builder::WriterBuilder;

let publisher = Publisher::new(&participant)?;

let writer_builder = WriterBuilder::<Data>::new(&topic).with_publisher(&publisher);
Source

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

Sets the Listener on this writer builder.

§Examples
use cyclonedds::WriterListener;
use cyclonedds::builder::WriterBuilder;

let writer_builder = WriterBuilder::<Data>::new(&topic).with_listener(WriterListener::new());
Source

pub fn build(self) -> Result<Writer<'d, 'p, 't, T>>

Builds the Writer.

§Errors

Returns an Error if the writer failed to create.

§Examples
use cyclonedds::QoS;
use cyclonedds::builder::WriterBuilder;
use cyclonedds::qos::policy;

let qos = QoS::new().with_durability(policy::Durability::TransientLocal);
let writer = WriterBuilder::<Data>::new(&topic).with_qos(&qos).build()?;

Trait Implementations§

Source§

impl<'domain, 'participant, 'topic, 'qos, T> Debug for WriterBuilder<'domain, 'participant, 'topic, 'qos, 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, 'topic, 'qos, T> !Send for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>

§

impl<'domain, 'participant, 'topic, 'qos, T> !Sync for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>

§

impl<'domain, 'participant, 'topic, 'qos, T> Freeze for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>

§

impl<'domain, 'participant, 'topic, 'qos, T> RefUnwindSafe for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>
where T: RefUnwindSafe,

§

impl<'domain, 'participant, 'topic, 'qos, T> Unpin for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>

§

impl<'domain, 'participant, 'topic, 'qos, T> UnsafeUnpin for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>

§

impl<'domain, 'participant, 'topic, 'qos, T> UnwindSafe for WriterBuilder<'domain, 'participant, 'topic, 'qos, T>
where T: RefUnwindSafe,

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.