Skip to main content

ReaderBuilder

Struct ReaderBuilder 

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

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

Implementations§

Source§

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

Source

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

Creates a new ReaderBuilder for the given Topic.

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

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

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

Sets the QoS for this reader builder.

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

pub const fn with_subscriber(self, subscriber: &'p Subscriber<'d, 'p>) -> Self

Sets the Subscriber on this reader builder.

§Examples
use cyclonedds::ReaderListener;
use cyclonedds::Subscriber;
use cyclonedds::builder::ReaderBuilder;

let subscriber = Subscriber::new(&participant)?;

let reader_builder = ReaderBuilder::<Data>::new(&topic).with_subscriber(&subscriber);
Source

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

Sets the Listener on this reader builder.

§Examples
use cyclonedds::ReaderListener;
use cyclonedds::builder::ReaderBuilder;

let reader_builder = ReaderBuilder::<Data>::new(&topic).with_listener(ReaderListener::new());
Source

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

Builds the Reader.

§Errors

Returns an Error if the reader failed to create.

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

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

Trait Implementations§

Source§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'domain, 'participant, 'topic, 'qos, T> UnwindSafe for ReaderBuilder<'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.