Macro evident::create_static_publisher
source · macro_rules! create_static_publisher { ($publisher_name:ident, id_type = $id_t:ty, msg_type = $msg_t:ty, entry_type = $entry_t:ty, interm_event_type = $interm_event_t:ty, $(filter_type=$filter_t:ty,)? $(filter=$filter:expr,)? capture_channel_bound = $cap_channel_bound:expr, subscription_channel_bound = $sub_channel_bound:expr, capture_mode = $capture_mode:expr, timestamp_kind = $timestamp_kind:expr ) => { ... }; ($visibility:vis $publisher_name:ident, id_type = $id_t:ty, msg_type = $msg_t:ty, entry_type = $entry_t:ty, interm_event_type = $interm_event_t:ty, $(filter_type=$filter_t:ty,)? $(filter=$filter:expr,)? capture_channel_bound = $cap_channel_bound:expr, subscription_channel_bound = $sub_channel_bound:expr, capture_mode = $capture_mode:expr, timestamp_kind = $timestamp_kind:expr ) => { ... }; }
Expand description
Macro to create a static publisher.
Usage
In the following example, text between <>
is used as placeholder.
The visibility setting at the beginning is also optional.
evident::create_static_publisher!(
<visibility specifier> <Name for the publisher>,
id_type = <Struct implementing `evident::event::Id`>,
msg_type = <Struct implementing `evident::event::Msg`>,
entry_type = <Struct implementing `evident::event::entry::EventEntry`>,
interm_event_type = <Struct implementing `evident::event::intermediary::IntermediaryEvent`>,
filter_type = <Optional Struct implementing `evident::event::filter::Filter`>,
filter = <Optional instance of the filter. Must be set if filter type is set>,
capture_channel_bound = <`usize` expression for the channel bound used to capture events>,
subscription_channel_bound = <`usize` expression for the channel bound used per subscription>,
capture_mode = <`evident::publisher::CaptureMode` defining if event finalizing should be non-blocking (`NonBlocking`), or block the thread (`Blocking`)>,
timestamp_kind = <`evident::publisher::EventTimestampKind` defining if event timestamp should be set on creation (`Created`), or on capture (`Captured`)>
);
Example without filter:
evident::create_static_publisher!(
pub MY_PUBLISHER,
id_type = MyId,
msg_type = String,
entry_type = MyEventEntry,
interm_event_type = MyIntermEvent,
capture_channel_bound = 100,
subscription_channel_bound = 50,
capture_mode = CaptureMode::Blocking,
timestamp_kind = EventTimestampKind::Captured
);
Example with filter:
evident::create_static_publisher!(
pub MY_PUBLISHER,
id_type = MyId,
msg_type = String,
entry_type = MyEventEntry,
interm_event_type = MyIntermEvent,
filter_type = MyFilter,
filter = MyFilter::default(),
capture_channel_bound = 100,
subscription_channel_bound = 50,
capture_mode = CaptureMode::NonBlocking,
timestamp_kind = EventTimestampKind::Captured
);
[req:qa.ux.macros]