pub struct Event {
pub id: u64,
pub event_type: String,
pub payload: Vec<u8>,
}Expand description
Simple event representation for filtering
Fields§
§id: u64§event_type: String§payload: Vec<u8>Implementations§
Source§impl Event
impl Event
Sourcepub fn decode(id: u64, bytes: &[u8]) -> Result<Self>
pub fn decode(id: u64, bytes: &[u8]) -> Result<Self>
Decode from raw event bytes (format: “type:json_payload”)
The format from ctx.log is “event_type:json_payload” where json_payload is the JSON-serialized form of the payload. Since event_type may contain colons (e.g., “knowledge:fact_learned”), we need to find the LAST colon that’s followed by valid JSON by actually attempting to parse.
Trait Implementations§
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