pub struct StreamEvent {
pub id: String,
pub event_type: String,
pub data: HashMap<String, Value>,
pub metadata: EventMetadata,
}Expand description
A streaming event with payload and metadata
Fields§
§id: StringUnique event identifier
event_type: StringEvent type/category
data: HashMap<String, Value>Event payload data
metadata: EventMetadataEvent metadata
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub fn new(
event_type: impl Into<String>,
data: HashMap<String, Value>,
source: impl Into<String>,
) -> Self
pub fn new( event_type: impl Into<String>, data: HashMap<String, Value>, source: impl Into<String>, ) -> Self
Create a new stream event
Sourcepub fn with_timestamp(
event_type: impl Into<String>,
data: HashMap<String, Value>,
source: impl Into<String>,
timestamp: u64,
) -> Self
pub fn with_timestamp( event_type: impl Into<String>, data: HashMap<String, Value>, source: impl Into<String>, timestamp: u64, ) -> Self
Create event with specific timestamp
Sourcepub fn matches_pattern(&self, pattern: &EventPattern) -> bool
pub fn matches_pattern(&self, pattern: &EventPattern) -> bool
Check if event matches a pattern
Sourcepub fn add_tag(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn add_tag(&mut self, key: impl Into<String>, value: impl Into<String>)
Add tag to event metadata
Sourcepub fn get_numeric(&self, field: &str) -> Option<f64>
pub fn get_numeric(&self, field: &str) -> Option<f64>
Get numeric value from event data
Sourcepub fn get_string(&self, field: &str) -> Option<&str>
pub fn get_string(&self, field: &str) -> Option<&str>
Get string value from event data
Sourcepub fn get_boolean(&self, field: &str) -> Option<bool>
pub fn get_boolean(&self, field: &str) -> Option<bool>
Get boolean value from event data
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamEvent
impl Debug for StreamEvent
Source§impl<'de> Deserialize<'de> for StreamEvent
impl<'de> Deserialize<'de> for StreamEvent
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 StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnwindSafe for StreamEvent
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