Struct evident::publisher::EvidentPublisher
source · pub struct EvidentPublisher<K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,{ /* private fields */ }
Expand description
An EvidentPublisher is used to capture, publish, and manage subscriptions.
[req:pub]
Implementations§
source§impl<K, M, T, F> EvidentPublisher<K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,
impl<K, M, T, F> EvidentPublisher<K, M, T, F>where K: Id + CaptureControl, M: Msg, T: EventEntry<K, M>, F: Filter<K, M>,
sourcepub fn new(
on_event: impl FnMut(Event<K, M, T>) + Send + 'static,
capture_mode: CaptureMode,
capture_channel_bound: usize,
subscription_channel_bound: usize,
time_stamp_kind: EventTimestampKind
) -> Self
pub fn new( on_event: impl FnMut(Event<K, M, T>) + Send + 'static, capture_mode: CaptureMode, capture_channel_bound: usize, subscription_channel_bound: usize, time_stamp_kind: EventTimestampKind ) -> Self
Create a new EvidentPublisher
without an event filter.
Note: You should use the macro create_static_publisher
instead.
[req:pub]
sourcepub fn with(
on_event: impl FnMut(Event<K, M, T>) + Send + 'static,
filter: F,
capture_mode: CaptureMode,
capture_channel_bound: usize,
subscription_channel_bound: usize,
timestamp_kind: EventTimestampKind
) -> Self
pub fn with( on_event: impl FnMut(Event<K, M, T>) + Send + 'static, filter: F, capture_mode: CaptureMode, capture_channel_bound: usize, subscription_channel_bound: usize, timestamp_kind: EventTimestampKind ) -> Self
Create a new EvidentPublisher
with an event filter.
Note: You should use the macro create_static_publisher
instead.
[req:pub], [req:cap.filter]
sourcepub fn get_filter(&self) -> &Option<F>
pub fn get_filter(&self) -> &Option<F>
Returns the event filter, or None
if no filter is set.
[req:cap.filter]
sourcepub fn entry_allowed(&self, entry: &impl EventEntry<K, M>) -> bool
pub fn entry_allowed(&self, entry: &impl EventEntry<K, M>) -> bool
Returns true
if the given event-entry passes the filter, or the event-ID is a control-ID.
[req:cap.filter]
sourcepub fn get_capture_mode(&self) -> CaptureMode
pub fn get_capture_mode(&self) -> CaptureMode
Returns the current capture mode.
sourcepub fn set_capture_mode(&self, mode: CaptureMode)
pub fn set_capture_mode(&self, mode: CaptureMode)
Allows to change the capture mode.
sourcepub fn get_missed_captures(&self) -> usize
pub fn get_missed_captures(&self) -> usize
Returns the number of missed captures in non-blocking mode since last reset.
sourcepub fn reset_missed_captures(&self)
pub fn reset_missed_captures(&self)
Resets the number of missed captures in non-blocking mode.
sourcepub fn subscribe(
&self,
id: K
) -> Result<Subscription<'_, K, M, T, F>, SubscriptionError<K>>
pub fn subscribe( &self, id: K ) -> Result<Subscription<'_, K, M, T, F>, SubscriptionError<K>>
Returns a subscription to events with the given event-ID,
or a SubscriptionError<K>
if the subscription could not be created.
[req:subs.specific.one]
sourcepub fn subscribe_to_many(
&self,
ids: Vec<K>
) -> Result<Subscription<'_, K, M, T, F>, SubscriptionError<K>>
pub fn subscribe_to_many( &self, ids: Vec<K> ) -> Result<Subscription<'_, K, M, T, F>, SubscriptionError<K>>
Returns a subscription to events with the given event-IDs,
or a SubscriptionError<K>
if the subscription could not be created.
[req:subs.specific.mult]
sourcepub fn subscribe_to_all_events(
&self
) -> Result<Subscription<'_, K, M, T, F>, SubscriptionError<K>>
pub fn subscribe_to_all_events( &self ) -> Result<Subscription<'_, K, M, T, F>, SubscriptionError<K>>
Returns a subscription to all events,
or a SubscriptionError<K>
if the subscription could not be created.
[req:subs.all]
sourcepub fn is_capturing(&self) -> bool
pub fn is_capturing(&self) -> bool
Returns true
if capturing is active.
[req:cap.ctrl.info]