pub struct Event {
pub id: EventId,
pub event_type: EventType,
pub source: String,
pub timestamp: u64,
pub data: EventData,
pub metadata: HashMap<String, String>,
}Expand description
An event in the streaming system.
Fields§
§id: EventId§event_type: EventType§source: String§timestamp: u64§data: EventData§metadata: HashMap<String, String>Implementations§
Source§impl Event
impl Event
Sourcepub fn new(
event_type: EventType,
source: impl Into<String>,
data: EventData,
) -> Self
pub fn new( event_type: EventType, source: impl Into<String>, data: EventData, ) -> Self
Create a new event.
Sourcepub fn with_id(
id: EventId,
event_type: EventType,
source: impl Into<String>,
data: EventData,
) -> Self
pub fn with_id( id: EventId, event_type: EventType, source: impl Into<String>, data: EventData, ) -> Self
Create an event with a specific ID.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata to the event.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&String>
pub fn get_metadata(&self, key: &str) -> Option<&String>
Get metadata value.
Sourcepub fn matches(&self, filter: &EventFilter) -> bool
pub fn matches(&self, filter: &EventFilter) -> bool
Check if the event matches a filter.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more