Trait evident::event::intermediary::IntermediaryEvent
source · pub trait IntermediaryEvent<K, M, T>where
Self: Sized,
K: Id,
M: Msg,
T: EventEntry<K, M>,{
// Required methods
fn new(event_id: K, msg: Option<impl Into<M>>, origin: Origin) -> Self;
fn get_entry(&self) -> &T;
fn take_entry(&mut self) -> T;
// Provided methods
fn get_event_id(&self) -> &K { ... }
fn finalize(self) -> FinalizedEvent<K> { ... }
fn into_event_id(self) -> K { ... }
}
Expand description
The IntermediaryEvent
trait is used to add information after setting an event,
and to be able to automatically capture events once they go out of scope.
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
Create a new IntermediaryEvent
.
Arguments
sourcefn get_entry(&self) -> &T
fn get_entry(&self) -> &T
Returns the EventEntry
that was created by this IntermediaryEvent
.
sourcefn take_entry(&mut self) -> T
fn take_entry(&mut self) -> T
Takes the EventEntry
that was created by this IntermediaryEvent
.
Provided Methods§
sourcefn get_event_id(&self) -> &K
fn get_event_id(&self) -> &K
Returns the Id
of this event
sourcefn finalize(self) -> FinalizedEvent<K>
fn finalize(self) -> FinalizedEvent<K>
Finalizing the event sends it to the publisher, and returns the FinalizedEvent
.
This struct includes the Id
used to set the event, and the id of the specific EventEntry
associated with this event.
Note: Finalizing prevents any further information to be added to the event.
sourcefn into_event_id(self) -> K
fn into_event_id(self) -> K
Converts this IntermediaryEvent
into the related event Id
.