pub struct Event { /* private fields */ }
Expand description
The Event
struct represents a log event.
It is a collection of key-value pairs
where the key is a string and the value is a string, number, or boolean
The value may also be None
to represent a null value.
Implementations§
Source§impl Event
impl Event
Sourcepub fn insert<T, S>(&mut self, key: S, value: T)
pub fn insert<T, S>(&mut self, key: S, value: T)
Insert a key-value pair into the event. If the key already exists, the value will be replaced.
§Example
use sigma_rust::Event;
let mut event = Event::new();
event.insert("name", "John Doe");
event.insert("age", 43);
event.insert("is_admin", true);
event.insert("null_value", None);
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &EventValue)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &EventValue)>
Iterate over the key-value pairs in the event
pub fn values(&self) -> impl Iterator<Item = &EventValue>
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 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