Trait evident::event::entry::EventEntry
source · pub trait EventEntry<K: Id, M: Msg>: Default + Clone + Hash + Send + Sync + 'static {
// Required methods
fn new(event_id: K, msg: Option<impl Into<M>>, origin: Origin) -> Self;
fn get_event_id(&self) -> &K;
fn into_event_id(self) -> K;
fn get_entry_id(&self) -> Uuid;
fn get_msg(&self) -> Option<&M>;
fn get_origin(&self) -> &Origin;
}
Expand description
Trait that must be implemented for a custom evident event-entry.
This implementation must then be used for implementations of the traits EventEntry
and IntermediaryEvent
.
All implementations are needed to create an evident publisher using the create_static_publisher!()
macro.
The optional Filter
trait must also use the same implementation of this Id
trait.
Note: Since it is a trait, the custom implementation may contain additional fields and functions.
[req:event.entry], [req:event.entry.generic]
Required Methods§
sourcefn new(event_id: K, msg: Option<impl Into<M>>, origin: Origin) -> Self
fn new(event_id: K, msg: Option<impl Into<M>>, origin: Origin) -> Self
Creates a new EventEntry
.
Note: This function should be called inside the implementation for IntermediaryEvent::new
.
Arguments
event_id
… The ID of the event that was set to create this entrymsg
… Optional main event messageorigin
… TheOrigin
the event was set at
[req:event.entry], [req:event.id], [req:event.msg], [req:event.origin]
sourcefn get_event_id(&self) -> &K
fn get_event_id(&self) -> &K
Returns the Id
of this event.
[req:event.id]
sourcefn into_event_id(self) -> K
fn into_event_id(self) -> K
Convert this EventEntry
into the Id
of this event.
[req:event.id]
sourcefn get_entry_id(&self) -> Uuid
fn get_entry_id(&self) -> Uuid
Get the entry-ID that was generated when the event was set.
[req:event.entry.id]
sourcefn get_msg(&self) -> Option<&M>
fn get_msg(&self) -> Option<&M>
Get the main message that was given when the event was set,
or None
if no message was given.
[req:event.msg]
sourcefn get_origin(&self) -> &Origin
fn get_origin(&self) -> &Origin
Get the Origin
the event was set at.
[req:event.origin]