Skip to main content

WriterListener

Struct WriterListener 

Source
pub struct WriterListener<T>
where T: Topicable,
{ /* private fields */ }
Expand description

Listener attached to a Writer<T>.

Implementations§

Source§

impl<T> WriterListener<T>
where T: Topicable,

Source

pub fn new() -> Self

Creates a new WriterListener<T> with no callbacks registered.

§Examples
use cyclonedds::TopicListener;

let listener = TopicListener::<Data>::new();
Source

pub fn with_liveliness_lost( self, callback: fn(&Writer<'_, '_, '_, T>, LivelinessLost), ) -> Self

Sets a callback for the LivelinessLost status event.

The callback receives a LivelinessLost metadata struct.

Fired when the writer fails to meet its Liveliness policy and is considered inactive by matched readers.

§Examples
use cyclonedds::listener::WriterListener;

let listener = WriterListener::<Data>::new().with_liveliness_lost(|writer, liveliness_lost| {
    println!(
        "{writer:?} liveliness lost: {}",
        liveliness_lost.total.count
    );
});
Source

pub fn with_offered_deadline_missed( self, callback: fn(&Writer<'_, '_, '_, T>, OfferedDeadlineMissed), ) -> Self

Sets a callback for the OfferedDeadlineMissed status event status event.

The callback receives an OfferedDeadlineMissed metadata struct.

Fired when the writer fails to write a new sample within its offered Deadline period for one or more instances.

§Examples
use cyclonedds::listener::WriterListener;

let listener = WriterListener::<Data>::new().with_offered_deadline_missed(
    |writer, offered_deadline_missed| {
        println!(
            "{writer:?} deadline missed: {}",
            offered_deadline_missed.total.count
        );
    },
);
Source

pub fn with_offered_incompatible_qos( self, callback: fn(&Writer<'_, '_, '_, T>, OfferedIncompatibleQoS), ) -> Self

Sets a callback for the OfferedIncompatibleQoS status event status event.

The callback receives an OfferedIncompatibleQoS metadata struct.

Fired when a reader is discovered whose requested QoS is incompatible with this writer’s offered QoS.

§Examples
use cyclonedds::listener::WriterListener;

let listener = WriterListener::<Data>::new().with_offered_incompatible_qos(
    |writer, offered_incompatible_qos| {
        println!("{writer:?} discovered incompatible QoS: {offered_incompatible_qos:?}");
    },
);
Source

pub fn with_publication_matched( self, callback: fn(&Writer<'_, '_, '_, T>, PublicationMatched), ) -> Self
where T: Topicable,

Sets a callback for the PublicationMatched status event.

The callback receives a PublicationMatched metadata struct.

Fired when a reader matching this writer’s topic and QoS is discovered.

§Examples
use cyclonedds::listener::WriterListener;

let listener = WriterListener::<Data>::new().with_publication_matched(|writer, status| {
    println!("{writer:?} matched readers: {}", status.current.count);
});

Trait Implementations§

Source§

impl<T> AsRef<WriterListener<T>> for WriterListener<T>
where T: Topicable,

Source§

fn as_ref(&self) -> &WriterListener<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Clone for WriterListener<T>
where T: Topicable + Clone,

Source§

fn clone(&self) -> WriterListener<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Copy for WriterListener<T>
where T: Topicable + Copy,

Source§

impl<T> Debug for WriterListener<T>
where T: Topicable + Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for WriterListener<T>
where T: Topicable,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for WriterListener<T>

§

impl<T> RefUnwindSafe for WriterListener<T>

§

impl<T> Send for WriterListener<T>

§

impl<T> Sync for WriterListener<T>

§

impl<T> Unpin for WriterListener<T>

§

impl<T> UnsafeUnpin for WriterListener<T>

§

impl<T> UnwindSafe for WriterListener<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.