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,
impl<T> WriterListener<T>where
T: Topicable,
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new WriterListener<T> with no callbacks registered.
§Examples
use cyclonedds::TopicListener;
let listener = TopicListener::<Data>::new();Sourcepub fn with_liveliness_lost(
self,
callback: fn(&Writer<'_, '_, '_, T>, LivelinessLost),
) -> Self
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
);
});Sourcepub fn with_offered_deadline_missed(
self,
callback: fn(&Writer<'_, '_, '_, T>, OfferedDeadlineMissed),
) -> Self
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
);
},
);Sourcepub fn with_offered_incompatible_qos(
self,
callback: fn(&Writer<'_, '_, '_, T>, OfferedIncompatibleQoS),
) -> Self
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:?}");
},
);Sourcepub fn with_publication_matched(
self,
callback: fn(&Writer<'_, '_, '_, T>, PublicationMatched),
) -> Selfwhere
T: Topicable,
pub fn with_publication_matched(
self,
callback: fn(&Writer<'_, '_, '_, T>, PublicationMatched),
) -> Selfwhere
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,
impl<T> AsRef<WriterListener<T>> for WriterListener<T>where
T: Topicable,
Source§fn as_ref(&self) -> &WriterListener<T>
fn as_ref(&self) -> &WriterListener<T>
Source§impl<T> Clone for WriterListener<T>
impl<T> Clone for WriterListener<T>
Source§fn clone(&self) -> WriterListener<T>
fn clone(&self) -> WriterListener<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more