pub struct Event {
pub id: String,
pub payload: Map<String, Value>,
pub metadata: Map<String, Value>,
}Expand description
An immutable unit of work moving through a branch’s step chain.
Fields§
§id: StringStable id, minted fresh per ingress emission.
payload: Map<String, Value>Trigger data (the ingress payload: cron tick, bus message, feed item, …).
metadata: Map<String, Value>Platform/trace metadata. Nodes add via Event::with_metadata.
Implementations§
Source§impl Event
impl Event
Sourcepub fn new(payload: Map<String, Value>) -> Self
pub fn new(payload: Map<String, Value>) -> Self
Mint a new event with a fresh id from a payload object.
Sourcepub fn from_json(value: Value) -> Self
pub fn from_json(value: Value) -> Self
Convenience constructor from any JSON value; non-object payloads are
wrapped as { "value": <v> } so the payload is always an object.
Sourcepub fn with_payload(&self, patch: Map<String, Value>) -> Event
pub fn with_payload(&self, patch: Map<String, Value>) -> Event
Return a copy with patch merged into the payload. Same id.
Sourcepub fn with_metadata(&self, patch: Map<String, Value>) -> Event
pub fn with_metadata(&self, patch: Map<String, Value>) -> Event
Return a copy with patch merged into the metadata. Same id.
Sourcepub fn payload_path(&self, path: &str) -> Option<&Value>
pub fn payload_path(&self, path: &str) -> Option<&Value>
Read a dotted path out of the payload (a.b.c), or None if absent.
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 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