pub struct Event {
pub name: String,
pub payload: Map<String, Value>,
pub tags: Map<String, Value>,
pub context: Map<String, Value>,
pub timestamp: i64,
}Expand description
A structured event, from Events::notify.
§Examples
let events = ocre::events::Events::default();
events.notify("user.signed_up", serde_json::json!({ "user_id": 7 }));
let event = &events.take()[0];
assert_eq!((event.name.as_str(), &event.payload["user_id"]), ("user.signed_up", &serde_json::json!(7)));Fields§
§name: StringWhat happened, e.g. order.placed.
payload: Map<String, Value>Its data; a payload that is not a JSON object is kept under value.
Tags of the Events that notified it (Events::tagged).
context: Map<String, Value>The request’s or job’s context (Events::set_context).
timestamp: i64When it happened, in Unix seconds.
Trait Implementations§
impl StructuralPartialEq for Event
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